Skip to content

Pull request? - Allocating underlying store from non-global allocator #259

@vron

Description

@vron

Hi,

I have a need to use bumpalo in a context where I do not want the backing storage to come from the global allocator.

If I did the work to provie a pull request to modify bumpalo such that it could allocate from a different allocator, would that be merged considered?

Specifically when I review the code I would suggest to:
under the nighly-allocatopr api flag do the following changes:

  • modify ChunkFooter to have an extra fields: allocator: &'static Allocator
  • replace the (only two?) calls to alloc() and dealloc() with calls to that field in the Chunk footer
  • Add additional "new" methog in bump where a static ref to the dersired allocator is provided

Obviously I have not tested this approach yet - wanted to check the interest before testing it / doing the work.

The clear downside of this is that a static ref to the underlying allocator must be used, but I cannot see any way to get aroundt his without introducing an additionall lifetime in Bump which I assume is not desired as it will complicate the API? (though it could be 'static by default when using the global allocator)

Please let me know if you want me to proceed with this work or not :-)

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