[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: memory leakage
From:       Doug Clapp <doug.clapp () triad ! rr ! com>
Date:       2010-02-11 21:25:45
Message-ID: 4B7475D9.3080601 () triad ! rr ! com
[Download RAW message or body]



Rob Landley wrote:
> On Wednesday 10 February 2010 09:11:01 Denys Vlasenko wrote:
>    
>> No need to parse anything. There is an applet (which you found "useless"
>> some years ago) which makes this sort of monitoring easy:
>>
>> # nmeter '%t %c mem %m free %[mf] processes %[pn]'
>> 16:10:05 UU........ mem 526m free 1.4g processes  276
>> 16:10:06 U......... mem 526m free 1.4g processes  276
>> 16:10:07 .......... mem 526m free 1.4g processes  276
>> ...
>>      
> This functionality is built into the stock version of top, but nobody ever
> bothered to make a UI to access it from the command line in busybox's version.
> Instead, busybox has a utility that isn't in stock Linux distros, which
> duplicates functionality from top but which requires learning a new printf-
> like syntax to make it work.
>
> Not my first choice of a design approach, no.  Still, as long as it's already
> there that guy might find it useful...
>
> Rob
>    

What about using the applet free to monitor memory usage?  If using a 
recent-enough version of busybox, watch could be used to repeat the 
invocation periodically.  Otherwise a while loop could do the same; for 
example:

# while [ 1 ] ; do date;free; sleep 5; done
Thu Feb 11 16:04:58 EST 2010
               total         used         free       shared      buffers
   Mem:       482988       450564        32424            0        22132
  Swap:       131064       131056            8
Total:       614052       581620        32432
Thu Feb 11 16:05:03 EST 2010
               total         used         free       shared      buffers
   Mem:       482988       450532        32456            0        22132
  Swap:       131064       131056            8
Total:       614052       581588        32464
Thu Feb 11 16:05:08 EST 2010
               total         used         free       shared      buffers
   Mem:       482988       450540        32448            0        22132
  Swap:       131064       131056            8
Total:       614052       581596        32456
^C


The original request gave the offending command sequence as

GATEWAY=`iproute | grep default | awk '{print $3}'



To my mind that contains one extra command.  For efficiency I would write

GATEWAY=`iproute | awk '/default/{print $3}' `

Using busybox 1.15.3 I just ran that sequence numerous times and saw no 
memory leakage that I could detect with the free command.  I used 
busybox ash, busybox iproute and busybox awk, as well as busybox free.  
My kernel is 2.6.25.16 running on an AMD Sempron processor.

Doug Clapp
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic