mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 12:29:07 +00:00
fix bug with freeing typed arrays
This commit is contained in:
@@ -1829,11 +1829,12 @@ pub const MarkedArrayBuffer = struct {
|
||||
pub const toJS = toJSObjectRef;
|
||||
};
|
||||
|
||||
export fn MarkedArrayBuffer_deallocator(bytes_: *anyopaque, ctx_: *anyopaque) void {
|
||||
var ctx = @ptrCast(*MarkedArrayBuffer, @alignCast(@alignOf(*MarkedArrayBuffer), ctx_));
|
||||
|
||||
if (comptime Environment.allow_assert) std.debug.assert(ctx.buffer.ptr == @ptrCast([*]u8, bytes_));
|
||||
ctx.destroy();
|
||||
export fn MarkedArrayBuffer_deallocator(bytes_: *anyopaque, _: *anyopaque) void {
|
||||
const mimalloc = @import("../../allocators/mimalloc.zig");
|
||||
// zig's memory allocator interface won't work here
|
||||
// mimalloc knows the size of things
|
||||
// but we don't
|
||||
mimalloc.mi_free(bytes_);
|
||||
}
|
||||
|
||||
pub fn castObj(obj: js.JSObjectRef, comptime Type: type) *Type {
|
||||
|
||||
Reference in New Issue
Block a user