Out off memory

2016-04-11 23:00:35 UTC-4 [Status] Agent restarted: reload.
2016-04-11 23:00:40 UTC-4 [Exit Code] imp restarted, reason: out of memory
2016-04-11 23:00:40 UTC-4 [Status] Device connected

My device have 9% of memory use…

my agent have 653401bytes of free memory
and my device have 70604 bytes of free memory

I dont get it

Do you have any loops in your device code that could eat all the memory?

Agents and Imps do not restart at exactly the same time. Could the restart of the agent trigger messages to the imp that it is ill-prepared for?

although with the amount of free memory you have it would be extreme, I also encountered frequent device ‘out of memory’ with over 20K free. In my case it turned out that specific high frequency logs were causing it. They seem to consume a lot of memory and are not releasing it quickly (or the GC doesn’t pick it up fast enough) causing this. Eliminating much of the logs solved it in my case…

I had 2 time imp.wakeup in the same function…so … :wink:

Usefully, imp.wakeup() returns a reference to the timer, so if you store that reference in a variable, you can later check to see if it is still running (timer != null) or has completed (timer == null). If necessary, you can cancel a running timer with imp.cancelwakeup(timer).