[PATCH alternative v2] ifplugd: fix netlink recv

Denys Vlasenko vda.linux at googlemail.com
Sun Aug 4 15:53:26 UTC 2013


On Tue, Jul 9, 2013 at 10:09 PM, Laurent Bercot
<ska-dietlibc at skarnet.org> wrote:
>> Hi,
>> here v2 of the patch that mallocs a buffer the size of pagesize and not more then 8192.
>
>  Coding style question.
>  Is there a reason why such temporary, local buffers should be allocated
> in the heap instead of in the stack ? Variable length arrays are C99, and
> have been supported by gcc for ages.

Stack on NOMMU machines is generally not growable on demand.
It is preallocated at program start.

Treating stack as a semi-infinite cheap storage is a misconception
in general. After you touch it, it is not freed until program exits.
If you used 1234k of stack for a few milliseconds and then
run for hours with much smaller stack actually used, all those 1234k
will be allocated and mapped RW.

bbox has "make stksizes" to find large stack allocations.

-- 
vda


More information about the busybox mailing list