Re: [MLton] Crash in GC

"Chris Cannam" <[email protected]> Tue, 08 Nov 2022 10:33:41 +0000
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
On Mon, 7 Nov 2022, at 19:28, Matthew Fluet wrote:
> So, you can see that with the default value of copy-generational-ratio
> 4.0, the runtime will never do generational collection.  In the
> absence of generational collection, the card marking doesn't matter
> --- we're always doing a majorGC and tracing the whole heap.

That's interesting, I hadn't noticed that the effect could be quite so... binary. Yet there it is in the gc-summary output:

With default options

GC type		time ms	 number		  bytes	      bytes/sec
-------------	-------	-------	---------------	---------------
copying		     92	     89	    509,627,808	  5,539,432,695	
mark-compact	      0	      0	              0	              -	
minor		      0	      0	              0	              -	

With copy-generational-ratio 10.0

GC type		time ms	 number		  bytes	      bytes/sec
-------------	-------	-------	---------------	---------------
copying		      6	      9	     20,408,272	  3,401,378,666	
mark-compact	      0	      0	              0	              -	
minor		     72	    586	     93,072,328	  1,292,671,222	

It makes little difference overall in this case, both are in the 3-4% range for time spent in GC.

So when it is *not* intending to perform any minor GCs, does it partition the heap differently? e.g. half and half old-gen and nursery and then swap the two after a major GC?

Under what conditions does a mark-compact collection occur? Is that only when running out of heap space?

I see the reference to Sansom 1991 - I haven't managed to find a copy that isn't paywalled, but also it's perhaps for the best if I don't read around the subject *too* thoroughly or I might never get anything else done!


Chris