mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Reduce memory usage in long-running processes (#14885)
This commit is contained in:
18
src/bun.js/bindings/BunJSCEventLoop.cpp
Normal file
18
src/bun.js/bindings/BunJSCEventLoop.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "root.h"
|
||||
|
||||
#include <JavaScriptCore/VM.h>
|
||||
#include <JavaScriptCore/Heap.h>
|
||||
|
||||
extern "C" int Bun__JSC_onBeforeWait(JSC::VM* vm)
|
||||
{
|
||||
if (vm->heap.hasAccess()) {
|
||||
vm->heap.releaseAccess();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void Bun__JSC_onAfterWait(JSC::VM* vm)
|
||||
{
|
||||
vm->heap.acquireAccess();
|
||||
}
|
||||
Reference in New Issue
Block a user