caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Event.channel memory leak?
@ 2010-03-01  8:04 Satoshi Ogasawara
  2010-03-01 20:34 ` [Caml-list] " ygrek
  0 siblings, 1 reply; 3+ messages in thread
From: Satoshi Ogasawara @ 2010-03-01  8:04 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Event.channel memory leak?
  2010-03-01  8:04 Event.channel memory leak? Satoshi Ogasawara
@ 2010-03-01 20:34 ` ygrek
  2010-03-02  4:40   ` Satoshi Ogasawara
  0 siblings, 1 reply; 3+ messages in thread
From: ygrek @ 2010-03-01 20:34 UTC (permalink / raw)
  To: caml-list

On Mon, 1 Mar 2010 17:04:31 +0900
Satoshi Ogasawara <ogasawara@itpl.co.jp> wrote:

> But, the next code makes increasing of memory use rapidly in my environment.
> (version 3.11.2 on MacOS X leopard)

Using Gc.compact instead of Gc.full_major doesn't exhibit such behaviour.

-- 
 ygrek
 http://ygrek.org.ua


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Event.channel memory leak?
  2010-03-01 20:34 ` [Caml-list] " ygrek
@ 2010-03-02  4:40   ` Satoshi Ogasawara
  0 siblings, 0 replies; 3+ messages in thread
From: Satoshi Ogasawara @ 2010-03-02  4:40 UTC (permalink / raw)
  To: caml-list

On 2010/03/02, at 5:34, ygrek wrote:
> On Mon, 1 Mar 2010 17:04:31 +0900
> Satoshi Ogasawara <ogasawara@itpl.co.jp> wrote:
>> But, the next code makes increasing of memory use rapidly in my environment.
>> (version 3.11.2 on MacOS X leopard)
> Using Gc.compact instead of Gc.full_major doesn't exhibit such behaviour.

Gc.compact works fine. Thank you for usefull comment. I did't understand the meanings
of Gc.full_major.

So, I'll release concurrent cell( http://forge.ocamlcore.org/projects/ccell/ ) version 3.0 
include FRP features after checking a few more memory behavior.

---
  ogasawara satoshi


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-02  4:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01  8:04 Event.channel memory leak? Satoshi Ogasawara
2010-03-01 20:34 ` [Caml-list] " ygrek
2010-03-02  4:40   ` Satoshi Ogasawara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).