More specifically:

http://groups.google.com/group/v8-users/msg/47d3cc9c9a3e9d0a

On Sep 27, 2008, at 12:30 PM, Garry wrote:

> Thanks - for future reference for anyone looking for the same thing..
> I ``fixed'' this by exposing v8::internal::Heap::CollectAllGarbage()
> by adding it to the v8:V8 interface in api.cc
>
> void V8::CollectAllGarbage()
> {
>       i::Heap::CollectAllGarbage();
> }
>
> Calling this at choice places (right before exit, after disposing a
> context etc) solves the problem completely for me.

This is just what the doctor ordered.

I'm not terribly enamored of the idea of altering V8 sources because  
it becomes a maintenance hassle to stay in synch, and anyway I  
ultimately want to link to the inevitable official Ubuntu binary  
shared library which won't have my changes, but one does what one must.

Another technique discussed in the thread was to allocate (and leak,  
from a C++ perspective) a bunch of handles to nudge V8 into deciding  
for itself to collect garbage. I suppose this could be done without  
altering V8 sources, but then the question becomes: how many handles  
is enough? The thread says it's around 4000... for now...


Pete Gontier <http://pete.gontier.org/>



On Oct 1, 2008, at 8:10 AM, deanm wrote:

> http://groups.google.com/group/v8-users/browse_thread/thread/9effc94911772167/bad37e520f88bf2f
>
> On Oct 1, 5:07 pm, Pete Gontier <[EMAIL PROTECTED]> wrote:
>> I would like to be able to test a WeakReferenceCallback.
>>
>> It would seem that in order to do that I need to induce garbage
>> collection at a predictable time.
>>
>> So far, I don't see a way to do that. Ideas?
>>
>> Pete Gontier <http://pete.gontier.org/>
> >


--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to