This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Node::ValueAt may be leaking memory #113
Closed
Description
After a glimpse to the methods in Node
(C++ side), I have the (untested of course) hypothesis that ValueAt
may be leaking memory.
ValueAt
creates new global ref for and objectobj
and callslookupOrCreate(obj)
lookupOrCreate
tries to find aNode
forobj
(if it previously existed, we created a new reference to it, and we are only deallocating one). If noNode
existed, calls the constructor ofNode
, which creates a new reference toobj
, but we do not release the original one at any point D:
Proposed solution is end ValueAt
method with:
return lookupOrCreate(val);
instead of
return lookupOrCreate(env->NewGlobalRef(val));