fitzgen / bumpalo

A fast bump allocation arena for Rust
https://docs.rs/bumpalo
Apache License 2.0
1.36k stars 111 forks source link

Allocation limit #135

Open stepancheg opened 2 years ago

stepancheg commented 2 years ago

Add an ability to limit the Bump size: if the number of allocated bytes exceeds the configured number, allocation should fail.

AFAIU, it is possible to make this feature with virtually no runtime overhead if the limit is checked only in alloc_layout_slow.

fitzgen commented 2 years ago

I would be open to reviewing and merging a PR that implements this functionality.

We should also have quickchecks that set random allocation limits, allocate from the bump and assert that the allocation limits are respected.

Eliasin commented 2 years ago

Hello! I tried my hand at implementing this feature, tell me what you think