Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] problem with marshal and bytecode threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Henri Dubois-Ferriere <henridf@l...>
Subject: [Caml-list] problem with marshal and bytecode threads
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