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

> On Tue, 23 Nov 2010 19:54:24 -0800
> "Kecheng" <kech...@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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to