Hi All,

(I've seen the topic of forcing garbage collection come up a few times
before on the list, but I didn't see anyone talking about this issue)

I've got a program which embeds V8 and I've some some unittests
written which exercise my program and thus V8.  To wrap native
objects, I use SetPointerInInternalField() and a wreak reference to
delete the native object when the garbage collector destroys the
javascript object.

This works well for most situations, but in a few cases, I want to
force the underlying native object to be deleted (e.g. to release
resources it holds).  I understand that I cannot do this directly with
v8, so I just steal ownership of the native object from the v8::Object
by calling SetPointerInInternalField(..., NULL).  This approach works
nicely for me because I happen to know that the v8::Object object will
never be used again in the program.

The problem is that this is tricky, and I'd like my tests to verify
that I've done it correctly.  As it stands, I get crashes when garbage
collection runs, which is in the middle of some subsequent test.  I'd
love to have a way, just for testing purposes, to force the garbage
collector to run, so that crashes occur in the actual failing test.

Is there a way to do this directly that I'm missing?

How have others handled this situation?

Cheers,

Ross

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

Reply via email to