mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-16 10:25:02 +01:00
free interned strings
This commit is contained in:
parent
6215924049
commit
88a3a585e7
1 changed files with 11 additions and 0 deletions
11
src/gc.rs
11
src/gc.rs
|
|
@ -148,6 +148,17 @@ impl RtAlloc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for RtAlloc {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
// free all interned strings
|
||||||
|
for str in &self.symbols {
|
||||||
|
let raw = str.0.as_ptr();
|
||||||
|
// SAFETY: No one has free these, see `Gc<T>`
|
||||||
|
let _ = unsafe { Box::from_raw(raw) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Symbol {
|
impl Symbol {
|
||||||
pub fn new(gc: Gc<str>) -> Self {
|
pub fn new(gc: Gc<str>) -> Self {
|
||||||
Self { gc }
|
Self { gc }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue