Browse thread
[Caml-list] Garbage collecting _everything_
- Roberto Bagnara
[
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: | 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 (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