caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ocaml DLL and memory leaks
@ 2007-05-09 10:45 Dmitry Bely
  2007-05-10 17:21 ` [Caml-list] " Xavier Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Bely @ 2007-05-09 10:45 UTC (permalink / raw)
  To: Caml List

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


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

end of thread, other threads:[~2007-05-11 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 10:45 Ocaml DLL and memory leaks Dmitry Bely
2007-05-10 17:21 ` [Caml-list] " Xavier Leroy
2007-05-11 13:19   ` Dmitry Bely

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