Skip to content

Possible memory safety features  #9

@ericphanson

Description

@ericphanson

We could include a mutable field in each AllocArray tracking whether it is active, and a vector in the bumper allocator object collecting all of the allocated arrays. Then when we reset the bump, we loop through and mark each array as inactive (which would cause eg getindex to error if called on it), and empty the list.

I think this would prevent “use after free” errors pretty comprehensively (in the serial case), possibly at the cost of some performance. It could be done as secondary types though, allowing debugging/testing with the safe version, then switching to the unchecked one for speed.

For concurrency safety, maybe some mechanism could be used for the resetting function to get exclusive access to each of the arrays in order to flip their activity bits. Eg if each array holds a lock? Or something where operations on the array don’t contest each other, but do contest with the resetter. Then we could empty the buffer once every array has been toggled inactive.

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