Skip to content
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
@ncordon

Description

@ncordon

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 object obj and calls lookupOrCreate(obj)
  • lookupOrCreate tries to find a Node for obj (if it previously existed, we created a new reference to it, and we are only deallocating one). If no Node existed, calls the constructor of Node, which creates a new reference to obj, 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));

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions