caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Garbage collecting _everything_
@ 2004-06-05 15:36 Roberto Bagnara
  2004-06-05 16:03 ` Daniel Bünzli
  2004-06-05 16:29 ` skaller
  0 siblings, 2 replies; 6+ messages in thread
From: Roberto Bagnara @ 2004-06-05 15:36 UTC (permalink / raw)
  To: caml-list


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 (http://valgrind.kde.org/) 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,

      Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-06-05 19:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-05 15:36 [Caml-list] Garbage collecting _everything_ Roberto Bagnara
2004-06-05 16:03 ` Daniel Bünzli
2004-06-05 16:11   ` Daniel Bünzli
2004-06-05 16:29 ` skaller
2004-06-05 16:50   ` Richard Jones
2004-06-05 19:46   ` Roberto Bagnara

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).