PyV8 disable automatic garbage collection

I have a problem that seems to be related to how Python and PyV8 garbage collection interacts. I temporarily solved the problem by disabling python garbage collection and calling gc.collect and PyV8.JSEngine.collect together every few seconds when JavaScript does not start. However, this seems like a pretty hacky solution ... in particular, I'm worried PyV8 might decide to assemble at the wrong time and cause problems, anyway. Is there a way to disable the automatic garbage collection of PyV8 forever, at least until I have several days to spend figuring out what is happening and thereby fixing the problem?

+4
source share
1 answer

You can easily turn off garbage collection by changing the source code for V8.

In the V8 source, edit src / heap.cc and place the return statement at the beginning of Heap :: CollectGarbage.

Other than that, this is not possible (AFAICT): V8 will always cause garbage collection when it runs out of memory. There is no (custom) way to do this.

+4
source

Source: https://habr.com/ru/post/1485246/


All Articles