• 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:

    1. A locked JsVar will not be collected by the GC
    2. All jsvNew[Whatever]() functions return locked variables.
    3. Any JsVar that is not intentionally returned to user code should be
      unlocked.
    4. Any JsVar that is returned (or child there of) should remain locked.

    Have I misunderstood anything? Is there anything significant I am missing?

About

Avatar for Gary.Ott @Gary.Ott started