Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-10-23 (16:12)
From: Henri Dubois-Ferriere <henridf@l...>
Subject: [Caml-list] problem with marshal and bytecode threads

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:
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?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: