From: Satoshi Ogasawara <ogasawara@itpl.co.jp>
To: caml-list@yquem.inria.fr
Subject: Event.channel memory leak?
Date: Mon, 1 Mar 2010 17:04:31 +0900 [thread overview]
Message-ID: <D1E9A95E-117C-461D-89DF-738CA8C70D14@itpl.co.jp> (raw)
Hello,
I have found a strange memory behavior with Event module. Following code
works well.
----
open Event
let ct () =
let c = new_channel () in
ignore (Thread.create (fun () -> sync (send c 1)) ());
let i = sync (receive c) in
()
let _ =
let rec loop () =
ct ();
Thread.delay 0.01;
Gc.full_major ();
loop ()
in
loop ()
----
But, the next code makes increasing of memory use rapidly in my environment.
(version 3.11.2 on MacOS X leopard)
----
open Event
let ct c =
ignore (Thread.create (fun () -> sync (send c 1)) ());
let i = sync (receive c) in
()
let _ =
let c = new_channel () in
let rec loop () =
ct c;
flush stdout;
Thread.delay 0.01;
Gc.full_major ();
loop ()
in
loop ()
----
I have read inside of Event module source code, but could not detect what data
remains in the memory.
Is this behavior not strange? And How can I avoid the memory behavior?
---
satoshi ogasawara
next reply other threads:[~2010-03-01 8:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 8:04 Satoshi Ogasawara [this message]
2010-03-01 20:34 ` [Caml-list] " ygrek
2010-03-02 4:40 ` Satoshi Ogasawara
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=D1E9A95E-117C-461D-89DF-738CA8C70D14@itpl.co.jp \
--to=ogasawara@itpl.co.jp \
--cc=caml-list@yquem.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