Re: help with huge memory consumption??



On 3月2日, 上午10时23分, Dan Miller <d...@xxxxxxxxxxxxxxx> wrote:
"Bin Chen" <binary.c...@xxxxxxxxx> wrote in news:1172800927.866571.297090
@8g2000cwh.googlegroups.com:



On 3ÔÂ2ÈÕ, ÉÏÎç9ʱ38·Ö, Dan Miller <d...@xxxxxxxxxxxxxxx> wrote:
I'm running a utility on kernel 2.6. When I run "ps aux", it shows my
utility as using 109MB of memory!!

root 5817 5.3 0.2 109132 1172 ? Ssl 18:01 1:23
/usr/src/ip3/shad

Total 197535

which is only about 200KB even with debug functions. I have no
explicit
malloc or new calls, I open 3 pthreads and one message queue.

I'm trying to figure out where all this memory is getting eaten up!!
I tried looking at /proc/`pidof shad`/status, and it shows
VmData: 106772 kB
which clearly is where my memory is consumed, but I don't know how to
break this down any further.

I've tried running objdump against the utility, but it just documents
essentially the same thing that 'size' does.

Is there anything else I can do to somehow enumerate this memory
usage??

There is a possibility that a dynamic library that you linked with
consume a lot of memory, check what libraries that your utility has
linked with by 'ldd'.

hmmm... that was interesting, but doesn't show memory usage of the
libraries:
linux-gate.so.1 => (0xffffe000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4002c000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4003f000)
libm.so.6 => /lib/tls/libm.so.6 (0x400fd000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40120000)
libc.so.6 => /lib/tls/libc.so.6 (0x40128000)
/lib/ld-linux.so.2 (0x40000000)

(BTW, I tell a lie; in this case, I have 14 pthreads running...)

Also, the proc status output shows
VmLib: 2128 kB
Isn't that the library usage?? Or is that just static library usage??
It is caused by pthread_create, I wrote a simple program and notice
the output the same of you, I don't know whether is it a bug:

#include <pthread.h>

pthread_t my_thread;

void thread_proc(void)
{
printf("abcde.\n");
}

int main(void)
{
int i;

for (i = 0;i < 1024;i ++)
{
if (pthread_create(&my_thread, NULL, &thread_proc, NULL) != 0)
{
printf("pthread create error.\n");
exit(0);
}
sleep(1);
}
}

The VmData increasing very fast, after a while:
VmData: 123108 kB




.



Relevant Pages

  • Re: Shared Object Problem
    ... > sundry dll's are loaded as well, sitting there hogging memory... ... libraries are "demand paged", and do not *actually* consume any ... initializers. ...
    (comp.unix.aix)
  • Re: help with huge memory consumption??
    ... I'm trying to figure out where all this memory is getting eaten up!! ... consume a lot of memory, check what libraries that your utility has ... Isn't that the library usage?? ...
    (comp.os.linux.development.system)
  • Re: Back to Being a Luddite (Oh Well)
    ... We had letter writing where you embedded the ... viruses in emails. ... CD- recorder "helpers" that sit in your system tray consuming memory ... system tray apps don't consume cycles. ...
    (comp.dcom.telecom)
  • Re: W3WP memory usage
    ... You may be correct regarding the libraries using the lion's share of memory. ... > I am quite aware that Sharepoint files are stored in the database. ... >>> public class SPVersion ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Will a large library cause WMP10 to slow system to a halt?
    ... 704 Megabytes Installed Memory ... of case likely would slow nearly everything down - not just the WMP. ... I have 2 250 Gb drives in a RAID 1 ... If you don't use libraries, how do you play music in WMP? ...
    (microsoft.public.windowsmedia.player)

Quantcast