Answer the question
In order to leave comments, you need to log in
Is it possible to temporarily disable GC in node.js when executing a certain piece of code?
When executing latency-sensitive code, you want to temporarily disable the GC and enable it back, something like this:
disableGc();
runCodeWithoutDelays();
enableGc();
Answer the question
In order to leave comments, you need to log in
No, but you can turn off the automatic garbage collector with command line switches and call it yourself, as needed:
node --nouse-idle-notification --expose-gc program.js
Now the gc() function will appear in the global, which you need to call.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question