fix memory leak

This commit is contained in:
Evan Almloff committed 2023-01-22 21:24:30 -06:00
1 parent c5f003e41e
commit 00a9ad29a8
1 file changed
+9
+9
View File
@@ -73,6 +73,15 @@ pub(crate) struct ScopeSlab {
entries: Slab<Slot<'static, ScopeState>>,
}
impl Drop for ScopeSlab {
fn drop(&mut self) {
// Bump slab doesn't drop its contents, so we need to do it manually
for slot in self.entries.drain() {
self.slab.remove(slot);
}
}
}
impl Default for ScopeSlab {
fn default() -> Self {
Self {