zsh-workers
 help / color / mirror / code / Atom feed
From: "Jérémie Roquet" <jroquet@arkanosis.net>
To: Kamil Dudka <kdudka@redhat.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>,
	"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: unbounded recursive call in a shell script crashes zsh
Date: Thu, 13 Apr 2017 18:01:13 +0200	[thread overview]
Message-ID: <CAFOazAM8N5ZQEv_HtQwt-18M6aNOTEMhGAmYxO0De1cjpjnjXA@mail.gmail.com> (raw)
In-Reply-To: <CAFOazAO2jcj+zPpJuHXtykUE4yGR0FnYA5+-xHgH4nu_gDZgbw@mail.gmail.com>

2017-04-13 17:21 GMT+02:00 Jérémie Roquet <jroquet@arkanosis.net>:
> Hence a total of 5856 bytes per recursion, or 5719 kiB for 10000 recursions.

Sorry, I meant 1000 recursions, obviously.

Here are the numbers when compiling using -O3 instead of -O0 -ggdb —
probably more useful for optimization:

execlist: 400 bytes
execpline: 416 bytes
execpline2: 224 bytes
execcmd_exec: 4864 bytes
execshfunc: 336 bytes
doshfunc: 704 bytes
runshfunc: 336 bytes
execode: 80 bytes
execlist: 400 bytes
execpline: 416 bytes
execpline2: 224 bytes
execcmd_exec: 4864 bytes
execif: 80 bytes

Aggregated:

execlist: 800 bytes
execpline: 832 bytes
execpline2: 448 bytes
execcmd_exec: 9728 bytes
execshfunc: 336 bytes
doshfunc: 704 bytes
runshfunc: 336 bytes
execode: 80 bytes
execif: 80 bytes

Hence an even higher total of 13344 bytes per recursion, or 13032 kiB
for 1000 recursions.

If I'm not mistaken, execcmd_exec seems to account for 73% of the stack usage.

-- 
Jérémie


  reply	other threads:[~2017-04-13 16:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 13:00 Kamil Dudka
2017-04-11 13:29 ` Jérémie Roquet
2017-04-11 14:01   ` Jérémie Roquet
2017-04-11 14:38     ` Kamil Dudka
2017-04-12  2:12       ` Bart Schaefer
2017-04-12  7:30         ` Kamil Dudka
2017-04-12 22:11           ` Bart Schaefer
2017-04-13 14:30             ` Kamil Dudka
2017-04-13 15:21               ` Jérémie Roquet
2017-04-13 16:01                 ` Jérémie Roquet [this message]
2017-04-15 16:14                   ` Bart Schaefer
2017-04-16 18:56                     ` Daniel Shahaf
2017-04-16 21:00                       ` Bart Schaefer
2017-04-16 23:12                         ` Daniel Shahaf
2017-04-17  0:17                           ` Bart Schaefer
2017-04-18 13:54                   ` Kamil Dudka
2017-04-19 21:01                     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFOazAM8N5ZQEv_HtQwt-18M6aNOTEMhGAmYxO0De1cjpjnjXA@mail.gmail.com \
    --to=jroquet@arkanosis.net \
    --cc=kdudka@redhat.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).