In the close function you shouldn't be calling jsvUnLock(parent); - that might help?
Basically you shouldn't unlock any objects that are passed in to a function or that are returned from one. It could be the extra unlock is causing the parent not to get freed.
One good way to check - if your code can be compiled for desktop - is to build it to run on your PC with DEBUG=1. This will compile in assert statements (as well as checking for memory leaks on exit), and it's very likely that if anything strange is happening it'll tell you.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
In the
close
function you shouldn't be callingjsvUnLock(parent);
- that might help?Basically you shouldn't unlock any objects that are passed in to a function or that are returned from one. It could be the extra unlock is causing the
parent
not to get freed.One good way to check - if your code can be compiled for desktop - is to build it to run on your PC with
DEBUG=1
. This will compile in assert statements (as well as checking for memory leaks on exit), and it's very likely that if anything strange is happening it'll tell you.