[MLton] Crash fread(...) failed (only read 0) (Cannot allocate memory) during deepFlatten with MLton 20070826

Matthew Fluet fluet at tti-c.org
Wed Apr 30 07:44:17 PDT 2008


On Tue, 29 Apr 2008, Nicolas Bertolotti wrote:
> It seems that releasing the card/cross map before allocating the heap 
> actually leads to some unexpected issues.
>
> In some cases (it occurs quite often on my 4 Gb debian box but it 
> remains sporadic), after the heap is allocated, the mmap() that is 
> performed in order to allocate the card/cross map fails.

That is certainly possible.  It was also a possible behavior before the 
patch that relases the card/cross map after dumping the heap to disk. 
Because the heaps and the card/cross maps are allocated separately, it is 
possible for a heap allocation to succeed, but consume so much memory that 
the card/cross map allocation fails.

> I am afraid it won't be possible to avoid that kind of issues as long as 
> the heap and the card/cross map are allocated separately. What do you 
> think ?

That seems to be the case.  This would actually consume a little more 
memory when using the copying collector, since both the from-heap and the 
to-heap will have card/cross maps allocated within them.  And resizing 
heaps would become a little more complicated, since the size of the 
card/cross map is proportional to the size of the heap.



More information about the MLton mailing list