Skip to content

Commit

Permalink
Simplify GC_free implementation
Browse files Browse the repository at this point in the history
Retrieving the base pointer for memaligned values is no longer necessary
since an upstream fix in BDWGC landed (f9a0ee08).
  • Loading branch information
jacob-hughes committed Aug 23, 2024
1 parent 8851851 commit 242f94d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions library/std/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,9 @@ unsafe fn gc_realloc(ptr: *mut u8, old_layout: Layout, new_size: usize) -> *mut
}

#[inline]
unsafe fn gc_free(ptr: *mut u8, layout: Layout) {
if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() {
unsafe {
bdwgc::GC_free(ptr);
}
} else {
unsafe {
bdwgc::GC_free(bdwgc::GC_base(ptr));
}
unsafe fn gc_free(ptr: *mut u8, _: Layout) {
unsafe {
bdwgc::GC_free(ptr);
}
}

Expand Down

0 comments on commit 242f94d

Please sign in to comment.