whippet icon indicating copy to clipboard operation
whippet copied to clipboard

Large object space mark initialization

Open Bike opened this issue 10 months ago • 0 comments

The comment on the marked field of large_object_space says that it is always nonzero and flips between two distinct values whenever there's a large collection. These values are presumably supposed to be LARGE_OBJECT_MARK_0 (1) and LARGE_OBJECT_MARK_1 (3) and flipped by xor with LARGE_OBJECT_MARK_TOGGLE_BIT (2). However, as far as I can tell, nothing actually initializes the marked field. So it starts out as 0 along with the rest of the structure, and then flips to 2, then back to 0, etc. Since large object marks are initialized to zero this can result in large objects being treated as marked, resulting in their edges not being traced, which can result in live objects being collected if they are otherwise unreachable.

I think this can be fixed by just adding space->marked = LARGE_OBJECT_MARK_0; to large_object_space_init. I think that fixes the problems in my tests. But I don't understand this code very well so maybe I'm missing something here.

Bike avatar Feb 25 '25 22:02 Bike