[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Satoshi Ogasawara <ogasawara@i...> |
| Subject: | Event.channel memory leak? |
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