Yes, a always got freed, and oops got the wrong reference count.
Because of the way Espruino works, there are a lot of small allocations. For example 1+2 allocates 1, 2 and finally 3. Sure, those could be freed without reference counting, but when objects are involved it gets virtually impossible without it.
What I really wanted to avoid was having code like this:
for (var i=0;i<1000;i++) {
SPI1.send([1,2,3]);
}
That had to pause in the middle of execution to garbage collect all the copies of the array [1,2,3]. At the cost of some execution speed, Espruino generally manages to be more predictable when it does execute :)
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.
Yes,
a
always got freed, andoops
got the wrong reference count.Because of the way Espruino works, there are a lot of small allocations. For example
1+2
allocates1
,2
and finally3
. Sure, those could be freed without reference counting, but when objects are involved it gets virtually impossible without it.What I really wanted to avoid was having code like this:
That had to pause in the middle of execution to garbage collect all the copies of the array
[1,2,3]
. At the cost of some execution speed, Espruino generally manages to be more predictable when it does execute :)