aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-09-28 19:06:04 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-28 19:06:04 -0700
commit4bdec01619ee7db408b21477e1f7860d9bfdf789 (patch)
tree07adedc411dfcaae4a4f75834c9b9ade147a2f91 /src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
parent2e8d9d46077887dd75f3d2d0e428cd2d491946f3 (diff)
downloadbun-4bdec01619ee7db408b21477e1f7860d9bfdf789.tar.gz
bun-4bdec01619ee7db408b21477e1f7860d9bfdf789.tar.zst
bun-4bdec01619ee7db408b21477e1f7860d9bfdf789.zip
Reduce memory usage of HTTP server (#6135)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp')
-rw-r--r--src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp b/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
new file mode 100644
index 000000000..f607d586a
--- /dev/null
+++ b/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp
@@ -0,0 +1,12 @@
+#include "root.h"
+#include "JavaScriptCore/VM.h"
+
+extern "C" void bun_on_tick_before(JSC::VM* vm)
+{
+ // Let the GC do some work while we are idle
+ vm->heap.releaseAccess();
+}
+extern "C" void bun_on_tick_after(JSC::VM* vm)
+{
+ vm->heap.acquireAccess();
+} \ No newline at end of file