Coding: V8 Garbage Collection

I went ahead and extracted the V8 wrapping code from my hobby engine and have put it up on github with some example code: v8wrap

There are other fine V8 wrappers out there and V8 is pretty easy to work with directly anyway, but maybe someone will find it useful and I'd love feedback/criticism from anyone that wants to offer it. One thing I would like to point out though about the code is the InstallGC/ForceGC functions. I've been reading a number of different blog entries from around the net about working with V8 and pretty much all of them will tell you that in order to get V8 to perform garbage collection you need to do something like this:

v8::V8::AdjustAmountOfExternalAllocatedMemory(SOME_LARGE_VALUE);

// or

while(!v8::V8::IdleNotification()) {};

While it is true that both of these methods can invoke the garbage collector, there is a more direct and thorough approach. If you make a call to v8::V8::SetFlagsFromString with the argument "--expose-gc" then a new global "gc" function will be exposed to your scripts, allowing you to very directly invoke the garbage collector.