From: John Lepikhin <john@ispsystem.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Re: memory usage
Date: Wed, 14 Jan 2009 00:00:42 +0800 [thread overview]
Message-ID: <1231862442.4376.315.camel@john-laptop> (raw)
In-Reply-To: <20090112220126.GA26026@annexia.org>
> Yeah, I flushed the output and I used /dev/zero - I still see no
> messages.
That's strange. Anyway, it looks like a memory leak, isn't it?
20 threads * 1KB max = 20 KB of memory for data storage should be used
(plus 20KB*500% for heap overhead = 100KB). I changed delay to 1 ms:
ignore (Unix.select [] [] [] 0.001);
After 2 minutes of work on FreeBSD, 19MB(!) was used:
# ps auxw | grep a.out | grep -v grep
root 35136 30.1 0.2 60348 19304 p5 L+ 1:36PM 2:08.07 ./a.out
# pmap <PID>:
Address Kbytes RSS Shared Priv Mode Mapped File
0000000000400000 204 360 - 360 r-x /tmp/a.out
0000000000532000 80 76 - 80 rw- /tmp/a.out
0000000000546000 28 16 - 28 rw- [ anon ]
0000000040532000 148 108 148 - r-x /libexec/ld-elf.so.1
0000000040557000 132 108 - 132 rw- [ anon ]
0000000040657000 28 28 - 28 rw- /libexec/ld-elf.so.1
000000004065E000 24 20 - 24 rw- [ anon ]
0000000040664000 92 76 92 - r-x /lib/libm.so.5
000000004067B000 4 4 - 4 r-x /lib/libm.so.5
000000004067C000 1024 0 1024 - r-x /lib/libm.so.5
000000004077C000 8 8 - 8 rw- /lib/libm.so.5
000000004077E000 64 64 64 - r-x /lib/libthr.so.3
000000004078E000 4 4 - 4 r-x /lib/libthr.so.3
000000004078F000 1024 12 1024 - r-x /lib/libthr.so.3
000000004088F000 12 12 - 12 rw- /lib/libthr.so.3
0000000040892000 8 8 - 8 rw- [ anon ]
0000000040894000 932 452 932 - r-x /lib/libc.so.7
000000004097D000 4 4 - 4 r-x /lib/libc.so.7
000000004097E000 1020 0 1020 - r-x /lib/libc.so.7
0000000040A7D000 116 116 - 116 rw- /lib/libc.so.7
0000000040A9A000 92 36 - 92 rw- [ anon ]
0000000040B00000 44032 13976 - 44032 rw- [ anon ]
00007FFFF85A4000 128 12 - 128 rw- [ anon ]
00007FFFF87A5000 128 12 - 128 rw- [ anon ]
00007FFFF89A6000 128 12 - 128 rw- [ anon ]
00007FFFF8BA7000 128 12 - 128 rw- [ anon ]
00007FFFF8DA8000 128 12 - 128 rw- [ anon ]
00007FFFF8FA9000 128 12 - 128 rw- [ anon ]
...
(gdb) info thr
18 Thread 0x40b01120 (LWP 101068) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
17 Thread 0x40b01290 (LWP 100489) 0x0000000040971cfc in select ()
from /lib/libc.so.7
16 Thread 0x40b01b30 (LWP 100079) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
15 Thread 0x40b04d80 (LWP 100858) 0x0000000040971cfc in select ()
from /lib/libc.so.7
14 Thread 0x40b02260 (LWP 101096) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
13 Thread 0x40b04200 (LWP 101128) 0x0000000040971cfc in select ()
from /lib/libc.so.7
12 Thread 0x40b03960 (LWP 101175) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
11 Thread 0x40b02820 (LWP 101189) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
10 Thread 0x40b03680 (LWP 101217) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
9 Thread 0x40b03f20 (LWP 100057) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
8 Thread 0x40b020f0 (LWP 100066) 0x0000000040971cfc in select ()
from /lib/libc.so.7
7 Thread 0x40b05ec0 (LWP 100535) 0x0000000040971cfc in select ()
from /lib/libc.so.7
6 Thread 0x40b04370 (LWP 100564) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
5 Thread 0x40b04c10 (LWP 100698) 0x0000000040971cfc in select ()
from /lib/libc.so.7
4 Thread 0x40b02b00 (LWP 101224) 0x0000000040971cfc in select ()
from /lib/libc.so.7
3 Thread 0x40b03ad0 (LWP 101227) 0x0000000040971cfc in select ()
from /lib/libc.so.7
2 Thread 0x40b037f0 (LWP 101258) 0x00000000408e4d4c in _umtx_op ()
from /lib/libc.so.7
* 1 Thread 0x40b05620 (LWP 100101) 0x00000000409643dc in open ()
from /lib/libc.so.7
(gdb)
I also added special thread to check GC:
let print_stats _ =
while true do
Gc.compact ();
Gc.print_stat stdout;
flush stdout;
Unix.sleep 10;
done
Thread.create print_stats ();
GC statistics after 1 minute:
minor_words: 21929847 <-- ?
promoted_words: 2474840
major_words: 2939105
minor_collections: 1655
major_collections: 635
heap_words: 61440
heap_chunks: 1
top_heap_words: 61440
live_words: 1024
live_blocks: 115
free_words: 60416
free_blocks: 1
largest_free: 60416
fragments: 0
compactions: 7
next prev parent reply other threads:[~2009-01-13 16:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 7:41 John Lepikhin
2009-01-12 8:39 ` [Caml-list] " Richard Jones
2009-01-12 9:14 ` John Lepikhin
2009-01-12 10:45 ` Sylvain Le Gall
2009-01-12 11:28 ` [Caml-list] " John Lepikhin
2009-01-12 11:41 ` Richard Jones
2009-01-12 15:03 ` John Lepikhin
2009-01-12 19:55 ` Richard Jones
2009-01-12 17:56 ` John Lepikhin
2009-01-12 20:12 ` Richard Jones
2009-01-12 21:34 ` John Lepikhin
2009-01-12 22:01 ` Richard Jones
2009-01-13 16:00 ` John Lepikhin [this message]
[not found] ` <20090112114837.GB18405@janestcapital.com>
2009-01-12 15:05 ` [Caml-list] " John Lepikhin
2009-01-12 16:29 ` Florian Hars
2009-01-12 16:44 ` John Lepikhin
2009-01-12 17:55 ` Sylvain Le Gall
2009-01-12 18:01 ` [Caml-list] " John Lepikhin
2009-01-12 18:26 ` Sylvain Le Gall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1231862442.4376.315.camel@john-laptop \
--to=john@ispsystem.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox