Open aneeshusa opened 8 years ago
Cool! Thanks for bringing this to my attention. It does sound like it would be a good idea to try to use the stdlib Allocator
once it exists. Your contribution would be welcome. Let me know if you hit any trouble along the way.
I suppose this might simplify doing things like garbage collecting a message after making changes.
@burdges: As far as I understand, I don't think so. I imagine the stdlib allocator trait would be a replacement for capnp::message::Allocator
, which handles allocation of entire segments. Within individual segments we carry out a form of arena allocation that needs to do a fair amount of capnproto-specific bookkeeping; I doubt we would be able to take advantage of a stdlib allocator trait there.
The Rust team yesterday accepted this RFC on a standard Allocator interface. It hasn't been implemented yet, but I was taking a look and it seems like it would cover the needs of the current
Allocator
trait incapnproto-rust
- we can use theLayout
struct to provide the same size + alignment properties thatWord
currently has.When this becomes implemented in the stdlib, would you be interested in using it instead of/to back the current
Allocator
scheme in this crate? I'd be interested in working on a PR for this in the future.