death

Henry Cejtin henry@sourcelight.com
Mon, 26 Nov 2001 20:55:00 -0600


I manually called invariant on &gcState right after the last array allocation
and the state was fine at that point.  The  next  read  returned  a  non-zero
value  which was not the full amount (the final short read), so it computed a
new used', saw that used' was NOT equal to size, did the tail call  to  loop,
which  then called read.  This read returned 0 so the last array was returned
from readFile, so main returned, so MLton_exit was called.  MLton_exit called
GC_done()  which  called  GC_enter() which called invariant() which failed in
the usual way.

Note, the point where  I  called  invariant()  by  hand  was  just  afer  the
LimitCheck  macro  before  the  array  creation.  Assuming this is ok (and it
seems to be from my reading of the ccodegen.h macros), this means that it  is
the  mutator  code in the case of the short read or in the case of the 0 read
that is causing the problem.