NOMMU: stack versus malloc?

Denys Vlasenko vda.linux at googlemail.com
Thu Oct 11 10:26:30 UTC 2007


> > > >> For example, lineedit.c currently eats 12k+ if stack.
> > > >>
> > > >> I can convert it into malloc use.
> > > >>
> > > >> Question: is it better or actually worse?
> > > >> Line editing is invoked repeatedly, and repeated malloc/free
> > > >> of random-sized blocks can increase fragmentation
> > > >> -> increase memory consumption.
> > > >
> > > >it really depends on the size of the consumption ... on nommu, the
> > > > default stack is 4k, so i'd say if you're talking about more than 1k,
> > > > it should be a malloc ...
> >
> > Ick... We have lots of ~4k stack users... and Makefile sets stack to 20k
> >  IIRC, correct me if I'm wrong:
> >
> > # Busybox is a stack-fatty so make sure we increase default size
> > # TODO: use "make stksizes" to find & fix big stack users
> > # (we stole scripts/checkstack.pl from the kernel... thanks guys!)
> > FLTFLAGS += -s 20000
> 
> we set the stack to 20k because of all the fatty stack buffers ;) ... so this 
> is a chicken & egg argument

Argument? I'm not trying to argue here, I am trying to understand
the situation with stack usage on NOMMU front before I go and
"fix" stuff which maybe doesn't need fixing.

> thinking about it more, fragmentation tends to be a much worse issue on no-mmu 
> than OOM, so allocating/freeing small buffers over the place would be 
> nasty ...

How malloc works on NOMMU? What happens when you have no brk space because
there is another process "above" you? Any URLs to memory management
in userspace on NOMMU?
--
vda




More information about the busybox mailing list