mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Free more data on worker destruction
This commit is contained in:
@@ -331,6 +331,16 @@ pub const All = struct {
|
||||
return JSValue.jsUndefined();
|
||||
}
|
||||
|
||||
pub fn deinit(this: *All) void {
|
||||
if (Environment.isWindows) {
|
||||
this.uv_timer.stop();
|
||||
}
|
||||
|
||||
this.maps.setImmediate.clearAndFree(bun.default_allocator);
|
||||
this.maps.setTimeout.clearAndFree(bun.default_allocator);
|
||||
this.maps.setInterval.clearAndFree(bun.default_allocator);
|
||||
}
|
||||
|
||||
const Shimmer = @import("../bindings/shimmer.zig").Shimmer;
|
||||
|
||||
pub const shim = Shimmer("Bun", "Timer", @This());
|
||||
|
||||
@@ -2433,6 +2433,7 @@ pub const VirtualMachine = struct {
|
||||
|
||||
// TODO:
|
||||
pub fn deinit(this: *VirtualMachine) void {
|
||||
this.timer.deinit();
|
||||
this.source_mappings.deinit();
|
||||
if (this.rare_data) |rare_data| {
|
||||
rare_data.deinit();
|
||||
|
||||
@@ -402,4 +402,24 @@ pub fn deinit(this: *RareData) void {
|
||||
if (this.boring_ssl_engine) |engine| {
|
||||
_ = bun.BoringSSL.ENGINE_free(engine);
|
||||
}
|
||||
|
||||
if (this.stderr_store) |store| {
|
||||
this.stderr_store = null;
|
||||
store.deref();
|
||||
}
|
||||
|
||||
if (this.stdout_store) |store| {
|
||||
this.stdout_store = null;
|
||||
store.deref();
|
||||
}
|
||||
|
||||
if (this.stdin_store) |store| {
|
||||
this.stdin_store = null;
|
||||
store.deref();
|
||||
}
|
||||
|
||||
if (this.entropy_cache) |cache| {
|
||||
this.entropy_cache = null;
|
||||
bun.default_allocator.destroy(cache);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user