Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Garbage collecting _everything_
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-05 (15:33)
From: Roberto Bagnara <bagnara@c...>
Subject: [Caml-list] Garbage collecting _everything_

Dear all,

we have written a small OCaml program that interfaces
to some C++ code.  For all the classes we have interfaced,
we have defined the required `struct custom_operations' that
is then registered with `register_custom_operations()'
and referred to in calls to `alloc_custom()'.  The finalization
functions invoke `delete' on the pointer embedded into the
OCaml value.  We do this with 6 different C++ classes that
are all handled in exactly the same way.

Then we have a small test program written in OCaml whose
last line is

   at_exit Gc.full_major;;

and for which valgrind ( says
we have memory leaks.  We have then verified that the
finalization functions for 2 of the created C++ objects
are never called.

As we are really beginners at OCaml programming, we are
sure we are missing something, but we don't know what.
Isn't `at_exit Gc.full_major;;' supposed to collect
_everything_ at program termination time?
Thanks in advane for your advice,


Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: