I'm learning to create my own extensions for Espruino. I have read the variousguides and documentation and referred to existing libraries which have enabled me to succeed in making a simple extension that does not leak memory.
My success is despite uncertainty around the purpose of jsUnLock() and when to use it. My understanding so far is:
A locked JsVar will not be collected by the GC
All jsvNew[Whatever]() functions return locked variables.
Any JsVar that is not intentionally returned to user code should be
unlocked.
Any JsVar that is returned (or child there of) should remain locked.
Have I misunderstood anything? Is there anything significant I am missing?
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.
I'm learning to create my own extensions for Espruino. I have read the various guides and documentation and referred to existing libraries which have enabled me to succeed in making a simple extension that does not leak memory.
My success is despite uncertainty around the purpose of
jsUnLock()
and when to use it. My understanding so far is:jsvNew[Whatever]()
functions return locked variables.unlocked.
Have I misunderstood anything? Is there anything significant I am missing?