4

I'm having an issue which seems to be related with the way Python & PyV8's garbage collection interact. I've temporarily solved the issue by disabling python's garbage collection, and calling gc.collect and PyV8.JSEngine.collect together every few seconds when no JavaScript is being run. However, this seems like a pretty hackish fix... in particular, I'm worried PyV8 might decide to collect at an inopportune time and cause problems, anyway. Is there any way to disable PyV8's automatic garbage collection for good, at least until I have a few days to spend figuring out exactly what is going on and thus to actually fix the issue?

Claudiu
  • 224,032
  • 165
  • 485
  • 680
  • You're having an issue... but what's the issue? – user2357112 Jul 06 '13 at 01:11
  • the issue is that javascript code will randomly stop executing. it used to segfault, but after i did the above fix it no longer segfaults.. however sometimes the javascript simply doesn't run. – Claudiu Jul 06 '13 at 02:20
  • the issue is irrelevant for the bounty, the bounty will go to he who figures out how to conquer V8's garbage collection – Claudiu Jul 06 '13 at 02:22

1 Answers1

4

It's possible to disable garbage collection for good by changing the source code of V8.

In V8's source, edit src/heap.cc, and put a return statement in the beginning of Heap::CollectGarbage.

Other than that, it's not possible (AFAICT): V8 will always invoke garbage collection when it's about to run out of memory. There is no (configurable) way to not have it do that.

Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235
  • Ah I wondered if that was the case. It seems I'd have to patch it myself to implement what I want... thanks for providing a good starting point for that! – Claudiu Jul 11 '13 at 16:02
  • In order for this to work I had to disable snapshotting, like this: `make x64.debug -j9 snapshot=off` – Vladislav Ivanishin Jul 29 '15 at 12:49