Removed v8::V8::Dispose call because it was causing SIGTRAPs in some exit scenarios. This is probably due to using the debug version of V8, but the documentation states that it's not necessary to call this anyway.
Use the PHP memory management functions emalloc and efree.
Refactor CommonJS modules functionality to store state in the extension globals and context as appropriate.