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
Segfault in caml_oldify_local_roots.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Brown <caml-list2@d...>
Subject: Re: [Caml-list] Segfault in caml_oldify_local_roots.
David Brown wrote:

 > Just wondering if anyone has any ideas on how I might debug this.  The
 > problem happens with ocaml-3.09.2, and doesn't with 3.08.3.  The program
 > uses camlzip as well as the sha1 binding pulled out of Xavier's 
 >  Program received signal SIGSEGV, Segmentation fault.
 >  52              caml_oldify_one (*sp, sp);

I found the problem, in how I was using the Gzip module.  I was doing
something like:

  let fd = open_out_bin ... in
  let zfd = Gzip.open_out_chan fd in
  Gzip.close_out zfd;
  close_out fd

Turns out that if I'd read it more carefully, I should have realized that
Gzip.close_out will also close the underlying handle.  Apparently calling
close_out twice on the same handle messes things up enough to segfault the
garbage collector.

Dave Brown