Closed ILyoan closed 9 years ago
No objection? Then I'll do this after HTTP and GPIO landed.
No objection. I am in.
I could not found the effective way to prevent it.
Guide not to create an instance of JObjectWrap
as local variable.
(https://github.com/Samsung/iotjs/wiki/Inside%20IoT.js#jobjectwrap)
Close as won't fix.
Instance of
JObjectWrap
never be created as local variable.Constructor of
JObjectWrap
set native pointer for javascript object so that when the object was reclaimed by garbage collector, the wrapper will also be reclaimed. If wrapper was created as local variable, this may lead double free.And first of all,
JObjectWrap
was designed to be used for holding javascript object throughout asynchronous program execution, not just for local time span.JObject
would just be fine for handling local javascript object.Preventing creating instance of
JObjectWrap
by moving constructor intoprivate
section and exposing static method for creating wrapper at heap space is an option.