caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Dynamic linking, reloading and garbage collection
@ 2003-12-11 17:00 Nuutti Kotivuori
  0 siblings, 0 replies; only message in thread
From: Nuutti Kotivuori @ 2003-12-11 17:00 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-12-11 17:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-11 17:00 [Caml-list] Dynamic linking, reloading and garbage collection Nuutti Kotivuori

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