[MLton] Card/cross map alignment broken?

Matthew Fluet mtf at cs.rit.edu
Tue Oct 13 12:14:53 PDT 2009


On Tue, 13 Oct 2009, Wesley W. Terpstra wrote:
> Due to the nature of the hang I have a strong suspicion that the GC is
> responsible. Things run smoothly until suddenly the program 'hangs', but
> changing GC parameters will move the location of the 'hang'. Looking through
> the GC code I strongly suspect that the crossMap is ending up unaligned.
> Placing it after the cardMap (a 1-byte aligned array) seems quite risky, but
> I lack the expertise in this area of the code to be certain this is a
> problem.
>
> Can someone familiar with this code please check that
>  s->generationalMaps.crossMap =
>    (GC_crossMap) (s->heap.start + s->heap.size + cardMapSize);
> indeed must be >8 bytes aligned?

All of heap.size, cardMapSize, and crossMapSize are aligned according to 
the system page size (s->sysvals.pagesize).  See sizeofCardMap and 
sizeofCrossMap in <src>/runtime/gc/generational.c; under the current 
parameters, they should always be the same size.  And heap.start is a 
large mmap with a page aligned size, so should be page aligned.

If you run with '@MLton gc-messages', you'll see the address at which the 
heap is allocated and the size of the card/cross map.



More information about the MLton mailing list