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] Strange Behaviour with Hashtables and Marshalling
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Amit Dubey <adubey@h...>
Subject: [Caml-list] Strange Behaviour with Hashtables and Marshalling

    Hi Everyone,

    I've recetly have two odd things happen to me in O'Caml, and I 
was wondering if anyone else has come across the same behaviour --

    (1) If I'm doing some processing, then I save a few relevant data
structures to disk with Marshal, terminate, then restart, reload
the data and then continue processing, I use significantly less memory than
if I process everything without stopping.  I'd imagine with garbage
collection, this wouldn't be a problem, yet I have come across it with both
the x86 and sparc native code versions (haven't tried bytecodes or any
other platform).  Forcing a GC collection doesn't seem to help.

    (2) If I'm saving really really big hashtables, which are part of
an enumerated type that can also contain closures ie: 

module MyHash = Hashtbl.Make(...)
type t = Table of float MyHash.t | Junk of foo | Func of (float -> float)

    After marshalling and reloading an instance of Table(s), some elements
in the table have mysteriously changed.  This isn't a problem if I change
the type of t to:

type t = Table of float MyHash.t | Junk of foo

    Again, I think I noticed this on both the sparc and x86 versions.

    I didn't find out exactly what was going on (deadlines!), but
I was just wondering if anyone might have ideas as to what the
problem might be.

    Amit Dubey

Bug reports:  FAQ:
To unsubscribe, mail  Archives: