From a63d7761aa967d85295e3f8f8310a6068174d401 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 7 Jan 2020 16:37:03 -0500 Subject: [PATCH] Adjust external allocated memory less often (#429) Stop using AdjustAmountOfExternalAllocatedMemory entirely. https://github.com/laverdet/node-fibers/pull/429#issuecomment-569979499 --- src/fibers.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/fibers.cc b/src/fibers.cc index 011260d..e26b216 100644 --- a/src/fibers.cc +++ b/src/fibers.cc @@ -9,13 +9,6 @@ #define THROW(x, m) return uni::Return(uni::ThrowException(Isolate::GetCurrent(), x(uni::NewLatin1String(Isolate::GetCurrent(), m))), args) -// Run GC more often when debugging -#ifdef DEBUG -#define GC_ADJUST 100 -#else -#define GC_ADJUST 1 -#endif - using namespace std; using namespace v8; @@ -578,7 +571,6 @@ class Fiber { THROW(Exception::RangeError, "Out of memory"); } that.started = true; - uni::AdjustAmountOfExternalAllocatedMemory(that.isolate, that.this_fiber->size() * GC_ADJUST); } else { // If the fiber is currently running put the first parameter to `run()` on `yielded`, then // the pending call to `yield()` will return that value. `yielded` in this case is just a @@ -758,10 +750,6 @@ class Fiber { that.yielded_exception = false; } - // Do not invoke the garbage collector if there's no context on the stack. It will seg fault - // otherwise. - uni::AdjustAmountOfExternalAllocatedMemory(that.isolate, -(int)(that.this_fiber->size() * GC_ADJUST)); - // Don't make weak until after notifying the garbage collector. Otherwise it may try and // free this very fiber! if (!that.zombie) {