Re: help with huge memory consumption??
- From: "Bin Chen" <binary.chen@xxxxxxxxx>
- Date: 1 Mar 2007 19:21:37 -0800
On 3月2日, 上午10时23分, Dan Miller <d...@xxxxxxxxxxxxxxx> wrote:
"Bin Chen" <binary.c...@xxxxxxxxx> wrote in news:1172800927.866571.297090It is caused by pthread_create, I wrote a simple program and notice
@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
explicitwhich is only about 200KB even with debug functions. I have no
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.
usage??Is there anything else I can do to somehow enumerate this memory
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??
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
.
- Follow-Ups:
- Re: help with huge memory consumption??
- From: Robert Redelmeier
- Re: help with huge memory consumption??
- References:
- help with huge memory consumption??
- From: Dan Miller
- Re: help with huge memory consumption??
- From: Bin Chen
- Re: help with huge memory consumption??
- From: Dan Miller
- help with huge memory consumption??
- Prev by Date: Re: help with huge memory consumption??
- Next by Date: Re: Exact mechanics of a system call
- Previous by thread: Re: help with huge memory consumption??
- Next by thread: Re: help with huge memory consumption??
- Index(es):
Relevant Pages
|