Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Roberto Bagnara <bagnara@cs.unipr.it>
To: caml-list@inria.fr
Subject: [Caml-list] Garbage collecting _everything_
Date: Sat, 05 Jun 2004 17:36:29 +0200	[thread overview]
Message-ID: <40C1E87D.9030903@cs.unipr.it> (raw)


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


             reply	other threads:[~2004-06-05 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-05 15:36 Roberto Bagnara [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40C1E87D.9030903@cs.unipr.it \
    --to=bagnara@cs.unipr.it \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox