[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 11:20:25 PDT 2008
On Wed, 30 Apr 2008, Nicolas Bertolotti wrote:
> I actually made some experiments using the attached "ugly" patch which
> does not really allocate both areas but basically ensures that the
> card/cross map allocation succeeds after the heap is allocated.
>
> It consists in allocating enough bytes for the heap and the card/cross
> map with mmap() each time a heap is allocated. Then, it immediately runs
> remap() in order to release the bytes that correspond to the card/cross
> map. The consequence is that, when it is necessary to allocate a new
> card/cross map after that, it always works.
>
> I was wondering whether it would be possible to do something in the same
> "spirit" rather than merging the heap and the card/cross map.
Not all platforms have mremap (I believe we only use it on linux). And I
doubt that there is a guarantee that if you mremap from N bytes to M
bytes, that you will necessarily be able to mmap N-M bytes. Same
thing goes if you munmap the N-M bytes. I imagine that it would be less
complicated to merge the heap and card/cross map.
More information about the MLton
mailing list