Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Alloy use boehmgc for all allocations? #119

Open
MarcWeber opened this issue May 14, 2024 · 3 comments
Open

Does Alloy use boehmgc for all allocations? #119

MarcWeber opened this issue May 14, 2024 · 3 comments

Comments

@MarcWeber
Copy link

Location

The Readme says cannot trace pointers unless using global allocators ?
So does it use boehmgc for all allocations ?
Wouldn't a better solution be a using a different allocator which when claiming memory from system registers than at boehmgc ?
So what's the benefit of using boehmgc for all allocations ? Wouldn't boehmgc be faster if it had to trace only pointers to GC<..> pointers ?

Summary

So it would be nice if you could document your intuition about this.

@jacob-hughes
Copy link
Collaborator

Hello Marc,

Wouldn't a better solution be a using a different allocator which when claiming memory from system registers than at boehmgc ?

In Alloy, we want to allow pointers to Gc<T> objects from non-GC'd heap allocations (i.e. Box<T>). The collector must therefore assume that any heap-allocated block could contain a pointer. Using the boehmgc's allocator for these non-GC'd allocations ensures that the collector will trace these blocks for indirect GC objects (i.e. GC objects not directly reachable from the stack).

Wouldn't boehmgc be faster if it had to trace only pointers to GC<..> pointers ?

Yes it would, but then we wouldn't be able to mix GC and non-GC'd objects.

Additionally, Alloy is fully conservative so a potential future improvement could be to use type information to allocate objects without boehmgc-alloc where we can guarantee that their memory never points to a Gc<T>.

@MarcWeber
Copy link
Author

Or the allocator when getting memory from system must register/unregister the blocks at boehmgc to be scanned.

@ltratt
Copy link
Member

ltratt commented Jun 18, 2024

@MarcWeber Not sure I understand that question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants