memory leakage
Rob Landley
rob at landley.net
Wed Feb 10 11:03:32 UTC 2010
On Wednesday 10 February 2010 04:04:44 farajian amin wrote:
> Dear All,
>
> I have experienced a memory leakage when i use busybox-1.14.1 on Snapgear
> linux( for leon architecture) (kernel 2.6.21.1). I am not quite sure that
> if this is a busybox problem or kernel. The problem is as follows:
>
> when we run the following script in busybox (ash) , the memory leak appears
> , and kill all mem at end. ---------------------------------
> #!/bin/ash
> while [ 1 ];
> do
> GATEWAY=`iproute | grep default | awk '{print $3}'
> done
To properly diagnose it, you could throw "top -n1" in the loop and see how
much memory usage grows. (Unfortunately, I don't see a way to tell busybox
top to sort by memory usage from the command line, the way hitting "m" when
it's interactive does. You'll probably need "top -n1 -b" and something to
parse the output. On the device side of things would be good if you're
talking to the device through a serial console and it takes a while to
trigger...)
That should tell you if a long-lived process (such as ash) is leaking memory.
There are a bunch of advanced techniques, of course, but that's a first quick
smoketest.
Building "screen" for your target (or dropbear) is another nice way to get
diagnostic info, although they'll drive it into OOM sooner since they use up
memory themselves, and I dunno how friendly either is to a nommu system.
If you can eliminate userspace processes, then that leaves a kernel leak.
Those are fiddlier, but they're not a busybox issue so we get to plead the 5th
about 'em here...
Rob
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
More information about the busybox
mailing list