NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore

Home Page:http://docs.nativescript.org/runtimes/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak in IsObjcObject

mbektchiev opened this issue · comments

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • iOS Runtime: 5.0.0

Describe the bug
IsObjcObject function in the runtime leaks memory due to calls to vm_read instead of vm_read_overwrite.

To Reproduce

  • Add the following code to some button's tap event:
for (var i = 0; i < 100; i++) {
    console.log(`${i} + ${UIApplication.sharedApplication}`);
}
  • Build and run the application in Instruments and start memory leak analysis
  • You will notice that after clicking a couple of times between two allocation generation marks there's a memory allocated by vm_read called by IsObjcObject. Calltree | Invert calltree option should be checked.

Expected behavior
When you click the button no new memory should be allocated in IsObjcObject.