In the userdata example, there is this function call:
js_newcconstructor(J, new_File, new_File, "File", 1);
For example, let's say the 'new_File' constructor function allocates memory with the malloc function.
If in the .js file I call:
var test = new File('abc'); //Creates the object and allocates some memory with malloc
test = null; //Dereference the object and the garbage collector can claim the memory
When the garbage collector claims the memory, how can I tell him to free the previously allocated memory in the constructor function too?
Maybe the 'js_newcconstructor' signature could be changed like this:
Hi!
Thanks for your great project!
It is really awesome!
In the userdata example, there is this function call:
js_newcconstructor(J, new_File, new_File, "File", 1);
For example, let's say the 'new_File' constructor function allocates memory with the malloc function.
If in the .js file I call:
When the garbage collector claims the memory, how can I tell him to free the previously allocated memory in the constructor function too?
Maybe the 'js_newcconstructor' signature could be changed like this:
So the garbage collector could call the 'finalize' function and this callback function could free the memory allocated by the constructor function.
Thanks!