Garbage collection #471
Replies: 3 comments
-
Posted at 2015-10-27 by @allObjects Could you pub some code about the issue? Some references may sttill hang around which keep stuff alive... Can you explain the need for load() by your app? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-10-28 by DrAzzy Can you share the code so we can take a look at it and see where it might be leaking? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-10-28 by @gfwilliams Garbage collection happens whenever Espruino thinks it is idle, but the memory usage reported by If the memory is rising, it's probably some extra information getting stored. Maybe try running It is possible it's a memory leak in Espruino, but those are extremely rare now - I haven't come across one in months. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-10-27 by Moray
So process.memory() does a garbage collection. Does garbage collection happen otherwise?
Asking because one of my programmes is running out of memory. The programme only has about 2500 bytes available following an initial save() so it is pretty tight.
It's just doing the same set of operations on a setInterval over and over again at long intervals, and in theory should use approx the same amount of memory each time as it is creating the same variables and not adding to what should be in memory. However after 5 iterations it runs out of memory. Use of process.memory() shows it gradually using more and more after each iteration.
For now I am simply replacing setInterval with a setTimeout which calls load() as I don't currently need state, however I will in due course.
I've reviewed the code and I am not obviously storing extra data each time, however i suspect my understanding of good memory management in JS may be weak, and the low memory and high async environment throws that sharply into relief of course.
Beta Was this translation helpful? Give feedback.
All reactions