[MLton] share weirdness

Stephen Weeks MLton@mlton.org
Thu, 20 Apr 2006 15:42:21 -0700


> Could it be that the sharing code is looking at some unused
> bytes in an object 

That certainly can happen.  The hash-consing code (see tableInsert()
and hashCons() in gc.c) looks at all the bytes in the object,
regardless of how they are used by the mutator.

> Even this `explanation' would require some statement as to how the
> background bytes got to be different.

When allocating a heap object, the mutator doesn't zero out unused
bytes (and maybe even bits within partially used bytes).  So,
depending on what was at the heap frontier, different stuff may appear
in the unused portion.