Skip to content

Start address passed to Space::grow_space does not necessarily need to be chunk-aligned #374

@wenyuzhao

Description

@wenyuzhao

Consider the following scenario:

In LargeObjectSpace, allocate one 5MB object and calls allocate_contiguous_chunks during allocation.
The allocated object is guaranteed to be chunk-aligned. highwater_mark is updated to the start address of the 1st chunk at here.
The subsequent grow_space then receives a chunk-aligned start address.

     1st chunk         2nd chunk
[aaaaaaaaaaaaaaaa] [aaaaaaaa--------]
 ^
 highwater_mark

Then allocate another 1MB object.
highwater_mark will be updated to some chunk-unaligned address within the 2nd chunk.
So under this case, the subsequent grow_space will receive an unaligned start address.

     1st chunk         2nd chunk
[aaaaaaaaaaaaaaaa] [aaaabbbb--------]
                        ^
                        highwater_mark

So either the chunk alignment check in grow_space is incorrect, or we should update highwater_mark to the end address of the object allocation, instead of the start address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions