On Wednesday, April 12, 2017 15:11:05 Bart Schaefer wrote: > On Wed, Apr 12, 2017 at 12:30 AM, Kamil Dudka wrote: > > On Tuesday, April 11, 2017 19:12:41 Bart Schaefer wrote: > >> In fact 4.3.11 running out of job table space means that it consumed > >> all malloc() memory before consuming all of the stack; > > > > I cannot confirm your hypothesis. > > Sorry, I forgot about (and missed because I was scanning for diffs in > job handling and that part hasn't changed) MAX_MAXJOBS. Either way it > means 4.3.11 ran out of job table space and never had a chance to > exercise the function call recursion limit. Still the question remains: Is it expected to run out of stack after <1000 nested calls of a trivial shell function when 1000 is the default limit for function call depth? I was trying to reduce the stack usage of zsh but was not really successful, mainly because I do not know how to efficiently find the automatic variables that consumed the biggest portion of the stack. The attached patch reduces the peak stack allocation on my example from 5.558 MB to 5.345 MB, so it is probably not worth applying at all. Do you have any estimation about where else the stack allocation could be reduced? Kamil