kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
436 stars 36 forks source link

Collect for allocator-api2 and hashbrown, also Metrics allocator #77

Closed kyren closed 11 months ago

kyren commented 11 months ago

Implements Collect for HashMap and HashSet from hashbrown, also Vec and Box from allocator-api2. Also implements a custom Allocator trait wrapper that records allocations and deallocations from gc-arena's Metrics handle, and is branded with the branding lifetime so it cannot be mixed up with other arena types.

The implementation for hashbrown is slightly subtle because it is different depending on whether or not the "allocator-api2" feature is also enabled. Circle-CI now also checks all combinations of the features "allocator-api2" and "hashbrown" to make sure they all compile.

This also subsumes #73 as it it's hard to disentangle them

kyren commented 11 months ago

Marking as a draft until I at least check it in piccolo..

kyren commented 11 months ago

I have working memory tracking in piccolo with this and also #79, it works so I'm unmarking it as a draft.

It can be merged as is, but this is a little in the way atm of effectively using it https://github.com/zakarumych/allocator-api2/pull/5