caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nuutti Kotivuori <naked+caml@naked.iki.fi>
To: caml-list@inria.fr
Subject: [Caml-list] Dynamic linking, reloading and garbage collection
Date: Thu, 11 Dec 2003 19:00:32 +0200	[thread overview]
Message-ID: <87llpj9tn3.fsf@naked.iki.fi> (raw)

I am thinking of a system where I would be dynamically loading files,
repeatedly in a long-lived OCaml process. But I am a bit uncertain how
things are handled.

Let's just assume Dynlink.loadfile_private for now - since loadfile
seems to open up a can of worms I'd rather not deal with, including
segmentation faults if interfaces change.

What is actually changed when I do Dynlink.loadfile_private? What
happens when I do Dynlink.loadfile_private again on the same file? 
Assuming also that the file could have changed in the meanwhile.

Atleast something is left behind right now. If I do:

,----
| Dynlink.init ();;
| Gc.print_stat stdout;;
| for i = 0 to 50000 do
|   Dynlink.loadfile_private "test.cmo";
| done;;
| Gc.compact ();;
| Gc.print_stat stdout;;
`----

I find that the process eats 20 megs of memory after loading the file
50000 times. And if I change that to be 100000 times, I get a fatal
exception of Stack_overflow. This is a bit worrying, since it might
have to scale up to 100000 different files some day as well.

So what gives? Or should I just read the source more?

-- Naked

-------------------
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:[~2003-12-11 17:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87llpj9tn3.fsf@naked.iki.fi \
    --to=naked+caml@naked.iki.fi \
    --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).