caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Edwin <edwintorok@gmail.com>
Cc: "Kecheng" <kecheng@cecs.pdx.edu>, caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] OCaml memory leak issue
Date: Wed, 24 Nov 2010 23:40:03 +0100	[thread overview]
Message-ID: <87lj4ipcqk.fsf@frosties.localnet> (raw)
In-Reply-To: <20101124093035.473bd2e5@deb0> ("Edwin"'s message of "Wed, 24 Nov 2010 09:30:35 +0200")

Török Edwin <edwintorok@gmail.com> writes:

> On Tue, 23 Nov 2010 19:54:24 -0800
> "Kecheng" <kecheng@cecs.pdx.edu> wrote:
>
>> Hi,
>> 
>> I used valgrind to check the memory usage of my OCaml byte code, but
>> I found that a memory leak. I'm very confused what the problem is. I
>> tried a very simple code as following, and compileed it. 
>> 
>> +++++++++++++++++++++++
>> let test  = 
>>     let a = 1 in
>>     let b = a + 5 in
>>     printf "%d\n" b;
>> ;;
>> test;;
>> +++++++++++++++++++++++
>
> I think you need to call the GC on exit explicitly, its not done by
> default.
>
> Best regards,
> --Edwin

Correct. Ocaml assumes (or knows which OS does) the OS will free all
resource at exit anyway. No point wasting valuable time doing a GC
sweep.

In case of custom blocks and finalize function I believe this to be an
error. Managing resources that the OS does not free (IPC tokens,
tempfiles, ...) is made much harder due to this.

MfG
        Goswin


  reply	other threads:[~2010-11-24 22:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24  3:54 Kecheng
2010-11-24  4:06 ` [Caml-list] " Edgar Friendly
2010-11-24  7:30 ` Török Edwin
2010-11-24 22:40   ` Goswin von Brederlow [this message]
2010-11-24 23:41     ` DS
2010-11-25 13:27       ` Goswin von Brederlow
2010-11-25  7:42     ` Christophe TROESTLER

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=87lj4ipcqk.fsf@frosties.localnet \
    --to=goswin-v-b@web.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=edwintorok@gmail.com \
    --cc=kecheng@cecs.pdx.edu \
    /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;
as well as URLs for NNTP newsgroup(s).