caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Dmitry Bely" <dmitry.bely@gmail.com>
To: "Caml List" <caml-list@inria.fr>
Subject: Ocaml DLL and memory leaks
Date: Wed, 9 May 2007 14:45:45 +0400	[thread overview]
Message-ID: <90823c940705090345k5c70fcc3p35ca3cc4412909c2@mail.gmail.com> (raw)

I have an Ocaml module packed into DLL that is dynamically loaded by
the main C program. What should I do to free all memory taken by Ocaml
runtime when the DLL is unloaded? The following scenario does not
work:

  [...]
  case DLL_PROCESS_ATTACH:
    [...]
    caml_startup(argv);
    break;

  case DLL_PROCESS_DETACH:
    value* at_exit = caml_named_value("Pervasives.do_at_exit");
    if (at_exit != NULL) caml_callback_exn(*at_exit, Val_unit);
    value* compact = caml_named_value("Gc.compact");
    if (compact != NULL) caml_callback_exn(*compact, Val_unit);
    /* Memory leak! */

Any idea?

- Dmitry Bely


             reply	other threads:[~2007-05-09 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 10:45 Dmitry Bely [this message]
2007-05-10 17:21 ` [Caml-list] " Xavier Leroy
2007-05-11 13:19   ` Dmitry Bely

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=90823c940705090345k5c70fcc3p35ca3cc4412909c2@mail.gmail.com \
    --to=dmitry.bely@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).