From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 4CDA8BC37 for ; Mon, 1 Mar 2010 09:03:36 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkQCAMgDi0vY5v4vmWdsb2JhbACbFhUBAQEBAQgLCgcTIroFhHsEgxU X-IronPort-AV: E=Sophos;i="4.49,559,1262559600"; d="scan'208";a="45727168" Received: from amout07.alpha-mail.net ([216.230.254.47]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Mar 2010 09:03:35 +0100 Received: from webarc05.alpha-mail.jp (webarc05.alpha-mail.jp [216.230.254.85]) by amout07.alpha-mail.net with ESMTP id o2183UJC028658; Mon, 1 Mar 2010 17:03:30 +0900 X-Virus-Scanned: amavisd-new at Alpha-Mail Out Received: from ltsub.alpha-mail.net (ltsub.alpha-mail.net [216.230.254.26]) by webarc05.alpha-mail.jp (Postfix) with ESMTP id 59055A48033; Mon, 1 Mar 2010 17:03:26 +0900 (JST) Received: from [192.168.0.101] (196.62.205.61.west.global.alpha-net.ne.jp [61.205.62.196]) by ltsub.alpha-mail.net (Alpha-mail) with ESMTP id 9E34E3B80B7; Mon, 1 Mar 2010 17:03:29 +0900 (JST) Message-Id: From: Satoshi Ogasawara To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Event.channel memory leak? Mime-Version: 1.0 (Apple Message framework v936) Date: Mon, 1 Mar 2010 17:04:31 +0900 X-Mailer: Apple Mail (2.936) X-Spam: no; 0.00; macos:01 stdout:01 0.01:98 0.01:98 rec:01 rec:01 data:02 module:03 module:03 flush:03 let:03 let:03 sync:04 sync:04 channel:06 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