[
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: | Goswin von Brederlow <goswin-v-b@w...> |
| Subject: | Re: [Caml-list] OCaml memory leak issue |
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