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

Nicolas Bertolotti Nicolas.Bertolotti at mathworks.fr
Tue Apr 29 08:21:12 PDT 2008


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.

I have been able to reproduce the issue (still sporadic) when building MLton itself with the options "-profile alloc -profile-stack true -profile-branch true -drop-pass deepFlatten". So, MLton itself can be a good example to investigate such issues.

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 ?

Here is an extract of a log corresponding to a crash after a backup to disk. I also faced the same kind of issue in other locations):
[GC: Starting gc #117; requesting 512 nursery bytes and 0 old-gen bytes,]
[GC:    heap at 0xa4e8b000 of size 1,497,899,008 bytes,]
[GC:    with nursery of size 19,748,440 bytes (1.3% of heap),]
[GC:    and old-gen of size 1,478,150,568 bytes (98.7% of heap),]
[GC:    and nursery using 19,747,956 bytes (1.3% of heap, 100.0% of nursery).]
[GC: Creating heap of size 3,317,579,776 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 3,226,595,328 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 3,135,610,880 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 3,044,626,432 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,953,641,984 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,862,657,536 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,771,673,088 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,680,688,640 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,589,704,192 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,498,719,744 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,407,735,296 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,316,750,848 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,225,766,400 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,134,781,952 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 2,043,797,504 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 1,952,813,056 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 1,861,828,608 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 1,770,844,160 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 1,679,859,712 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 1,588,875,264 bytes cannot be satisfied,]
[GC:    backing off by 90,984,448 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Creating heap of size 1,497,899,008 bytes cannot be satisfied,]
[GC:    backing off by 90,976,256 bytes with minimum size of 1,497,899,008 bytes.]
[GC: Starting major mark-compact;]
[GC:    heap at 0xa4e8b000 of size 1,497,899,008 bytes.]
[GC: Finished major mark-compact; mark compacted 1,472,403,176 bytes.]
[GC: Growing heap at 0xa4e8b000 of size 1,497,899,008 bytes,]
[GC:    to desired size of 3,317,579,776 bytes and minimum size of 1,472,403,688 bytes.]
[GC: Shrinking heap at 0xa4e8b000 of size 1,497,899,008 bytes to size 1,472,405,504 bytes.]
[GC: Creating heap of size 3,317,579,776 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 3,225,317,376 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 3,133,054,976 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 3,040,792,576 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,948,530,176 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,856,267,776 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,764,005,376 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,671,742,976 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,579,480,576 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,487,218,176 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,394,955,776 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,302,693,376 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,210,430,976 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,118,168,576 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,025,906,176 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 1,933,643,776 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 1,841,381,376 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 1,749,118,976 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 1,656,856,576 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 1,564,594,176 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 1,472,405,504 bytes cannot be satisfied,]
[GC:    backing off by 92,188,672 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Writing heap at 0xa4e8b000 of size 1,472,403,176 bytes to disk.]
[GC: Releasing heap at 0xa4e8b000 of size 1,472,405,504 bytes.]
[GC: Releasing card/cross map at 0x560ed000 of size 11,706,368 bytes.]
[GC: Creating heap of size 3,317,579,776 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 3,225,317,376 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 3,133,054,976 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 3,040,792,576 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Creating heap of size 2,948,530,176 bytes cannot be satisfied,]
[GC:    backing off by 92,262,400 bytes with minimum size of 1,472,405,504 bytes.]
[GC: Created heap at 0x55719000 of size 2,856,267,776 bytes.]
[GC: Reading heap at 0xa4e8b000 of size 1,472,403,176 bytes from disk.]
08048000-08b2e000 r-xp 00000000 00:24 722141                             /mathworks/GNB/hub/pst/build-tools-R2008b-V2/lib/mlton/mlton-compile
08b2e000-08d37000 rwxp 00ae6000 00:24 722141                             /mathworks/GNB/hub/pst/build-tools-R2008b-V2/lib/mlton/mlton-compile
08d37000-08d66000 rwxp 08d37000 00:00 0                                  [heap]
55555000-5556b000 r-xp 00000000 08:01 817820                             /emul/ia32-linux/lib/ld-2.3.6.so
5556b000-5556d000 rwxp 00015000 08:01 817820                             /emul/ia32-linux/lib/ld-2.3.6.so
5556d000-55570000 rwxp 5556d000 00:00 0
55570000-55571000 ---p 55570000 00:00 0
55571000-55575000 rwxp 55571000 00:00 0
55575000-55576000 ---p 55575000 00:00 0
55588000-555aa000 r-xp 00000000 08:01 817813                             /emul/ia32-linux/lib/libm-2.3.6.so
555aa000-555ac000 rwxp 00021000 08:01 817813                             /emul/ia32-linux/lib/libm-2.3.6.so
555ac000-555e1000 r-xp 00000000 00:24 8913268                            /mathworks/GNB/hub/pst/build-tools-R2008b-V2/lib/libgmp.so.3.4.1
555e1000-555e2000 rwxp 00035000 00:24 8913268                            /mathworks/GNB/hub/pst/build-tools-R2008b-V2/lib/libgmp.so.3.4.1
555e2000-55703000 r-xp 00000000 08:01 817811                             /emul/ia32-linux/lib/libc-2.3.6.so
55703000-55708000 r-xp 00120000 08:01 817811                             /emul/ia32-linux/lib/libc-2.3.6.so
55708000-5570a000 rwxp 00125000 08:01 817811                             /emul/ia32-linux/lib/libc-2.3.6.so
5570a000-5570d000 rwxp 5570a000 00:00 0
5570d000-55717000 r-xp 00000000 00:24 62046843                           /mathworks/GNB/hub/pst/build-tools-R2008b-V2/lib/libgcc_s.so.1
55717000-55718000 rwxp 00009000 00:24 62046843                           /mathworks/GNB/hub/pst/build-tools-R2008b-V2/lib/libgcc_s.so.1
55718000-ffb0c000 rwxp 55718000 00:00 0
ffe50000-ffe57000 rwxp ffe50000 00:00 0                                  [stack]
ffffe000-fffff000 r-xp ffffe000 00:00 0
Out of memory (2).  Unable to allocate 22,315,008 bytes.

-> Out of memory (2) corresponds to the function GC_mmapAnon_safe(). I have updated the call to die() in order to print the actual number of bytes we are trying to allocate and have a different message than other out of memory errors):
< die ("Out of memory.\n")
> die ("Out of memory (2).  Unable to allocate %s bytes.\n", uintmaxToCommaString(length));




More information about the MLton mailing list