NOMMU: stack versus malloc?

Alex Landau landau_alex at yahoo.com
Thu Oct 11 06:29:24 UTC 2007


--- Jate Sujjavanich <jsujjavanich at syntech-fuelmaster.com> wrote:

> The m68knommu device (Coldfire 5235) I've been working on has 16 MB of
> SDRAM, so fragmentation has been more of an issue for me than overall
> memory usage on uClinux. I say do things to reduce the memory usage
> without increasing fragmentation. On a system with less memory, it will
> eventually make your usable memory smaller no matter what total you have
> free.
> 
> If you have a large buffer that must be used very often, I think you
> should malloc it once, make it static/force it into the data section, or
> place it on the stack. If it will be used only rarely, you might get
> away with with malloc'ing the small number of times it's used.
> 
> Incidentally, the dreaded "unable to allocate memory" due to
> fragmentation reared its ugly head when I was debugging busybox/msh
> yesterday. After I restarted msh around 10 times.
> 
> - Jate S.
> 

I second that. Even on a 64MB Blackfin box, I saw many "unable to allocate memory"
messages due to fragmentation. Busybox was not the cause, but still I'd prefer not seeing
these messages.
Interestingly, switching toolchanins from bfin-uclinux to bfin-linux-uclibc made this
problem manifest itself much less often.

Alex


       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  



More information about the busybox mailing list