Skip to content

Don't use MMTk to allocate memory for data which isn't part of the GCed heap #3

@angussidney

Description

@angussidney

Ideally, all memory allocated by Ruby should be separated into two types:

  • Memory that is logically part of the GCed heap (i.e. it's liveness is determined by reachability from the program roots)
    • This includes both the 40-byte object 'slots' and their payload data (e.g. arrays longer than 3 objects, strings longer than 23 chars)
    • This should be managed by MMTk
  • All other memory
    • This should remain explicitly managed by malloc/free

Currently, all of the 40-byte slots are allocated with newobj_of, which has been modified to use MMTk. This has been implemented as it semantically should.

However, most other memory allocation is performed using objspace_xmalloc0 (or an alias thereof), which is a wrapper around malloc. This function is used for both memory that is logically part of the GCed heap, and memory that should be explicitly managed. Currently, I have modified this function to call MMTk's alloc; however, this has the side affect that some memory is being managed by MMTk when it really should be explicitly managed. This should be fixed before we make too much progress on actual GCs, because it may introduce bugs later down the line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions