On Wed, Apr 21, 2010 at 08:56:04AM -0500, Gary Altenberg wrote:
> I’m working with uClinux on a NOMMU ARM and using BusyBox. I have seen people 
> in this list talk about NOMMU memory fragmentation issues. I’m just wondering 
> if I’m going to run into major memory fragmentation problems if I run shell 
> scripts a lot. I have written a few shell scripts to move files around and 
> have them running frequently. I see that they seem to spawn children with 
> vfork or something when I do things like sleep or cp. Does anyone have any 
> advice about how to approach these issues? Should I try to write applications 
> to handle these things instead of using shell scripts?

Well if your shell scripts run and terminate (freeing all the ram they
used as a result) and no other processes allocate any memory while they
run, then you should not have a problem from that.

On the other hand if you do something like:

launch a process from a startup script and background it
launch another process from startup script and background it, while
the first one is making memory allocations or calling external scripts
and commands
etc

Then you are likely to end up causing a lot of fragmentation.

I did find that making busybox as small as possible in the heap+bss+stack
usage made a big difference in how much memory was used and how fragmented
things got.  In my case my busybox config was using 67KB, but by making
a few config changes (switch mv/cp buffer to malloc instead of stack and
remove a few unused features), I dropped that to 59KB.  Of course 59KB
requires a 64KB chunk, while 67KB requires a 128KB chunk in the nommu
power of two allocator, so that suddenly makes each busybox command
require half as much memory, and hence only need half as big a chunk
of memory.  Suddenly an 8MB machine was doing very well, where before a
shell script piping 4 or 5 commands together could make it run out of
ram (in big enough pieces, there were lots of 32 and 64KB chunks left
but those were not big enough to be useful).

-- 
Len Sorensen
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to