You are reading a single comment by @Moray and its replies. Click here to read the full conversation.
  • 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.

About

Avatar for Moray @Moray started