caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] problem with marshal and bytecode threads
@ 2002-10-23 16:12 Henri Dubois-Ferriere
  0 siblings, 0 replies; only message in thread
From: Henri Dubois-Ferriere @ 2002-10-23 16:12 UTC (permalink / raw)
  To: caml-list

Hi,

After some headbanging, I realized that the out_of_memory exception I was
getting on a Marshal.from_channel was only happening when running a
thread-enabled bytecode executable.

I then tried making a simplified reproducible example, and though I
couldn't get the out_of_memory exception, I did see some weird behavior:

testthread.ml:
type mytype = T of (float * float)
let fd = open_out_bin "/tmp/file.mld"
let myval = T (1.0, 1.0)
Marshal.to_channel fd myval []
close_out fd

let fd = open_in_bin "/tmp/file.mld"
let myval = (Marshal.from_channel fd: mytype)
match myval with
   T bla -> bla


running this snippet in a thread-enabled toplevel makes it segfault.
(the toplevel is made as such:
%ocamlmktop -thread /usr/lib/ocaml/threads/unix.cma
/usr/lib/ocaml/threads/threads.cma -o ocaml-th)


In fact, entering the code line-by-line in the toplevel shows that the
type of myval is not recognized:
# let myval = (Marshal.from_channel fd : mytype)
val myval : mytype = <unknown constructor>

I haven't filed a bug because I doubt such an obvious
one would have gone by unnoticed, which leaves the more likely option that
I missed something in the docs/list archives/bug database...

any clues anyone?

Thanks
Henri

-------------------
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:[~2002-10-23 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-23 16:12 [Caml-list] problem with marshal and bytecode threads Henri Dubois-Ferriere

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