lloyd / node-toobusy

Build Node.JS servers that don't fall over.
1.3k stars 128 forks source link

Missing HandleScopes #2

Closed ryancole closed 11 years ago

ryancole commented 11 years ago

I've only written a few node addons, so I may be wrong, but shouldn't you be creating a HandleScope in any function that uses v8 classes? You export a few functions to JS land that do not contain one. Is this valid safe because of the HandleScope you create in the init function?

lloyd commented 11 years ago

Yo @ryancole - My understanding is that usage of HandleScopes can minimize the lifetime of allocated objects. Because in the two functions in question we're not allocating any handles which reference objects on the heap, and are just returning primitives, it's my belief that a HandleScope would be counter-productive.

Admittedly, this optimization is probably meaningless - I documented my understanding of why we don't need handlescopes in the couple functions in question in code.