Log if element arena allocation is >80%

We recently doubled the size of the `ELEMENT_ARENA` after someone ran
into a panic due to the arena running out of space.

This adds some logging so that we can hopefully develop a better
understanding of when the element area's allocation is elevated.

Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
Thorsten Ball 2024-01-24 11:03:28 +01:00
parent bd6197eb2f
commit 18f5752f04
2 changed files with 15 additions and 1 deletions

View file

@ -44,6 +44,14 @@ impl Arena {
}
}
pub fn len(&self) -> usize {
self.offset as usize - self.start as usize
}
pub fn capacity(&self) -> usize {
self.end as usize - self.start as usize
}
pub fn clear(&mut self) {
self.valid.set(false);
self.valid = Rc::new(Cell::new(true));