Agent memory limit

I was sending some data (23940 bytes ~ 24kB) from a device to it’s agent. I got this message:

2016-05-19 08:13:58 UTC+10 [Agent] ERROR: Memory limit of 2048kB briefly exceeded
2016-05-19 08:13:58 UTC+10 [Agent] ERROR: Out of memory (1024kB used)

I don’t understand why this would have happened. Is there a agent.getmemoryfree() or similar (corresponding to the device command) to help debug this? Any other tips?


imp.getmemoryfree() works on the agent too. I suspect you have some objects which you think you’ve got rid of but are still referenced somewhere.

@coverdriven also recently posted some code which will walk the heap and tell you where your memory is being used - see this thread

Thanks Hugo. I was storing data as a table of key:value pairs. I’ve changed to using an array of keys and an array of values instead, and it seems to be better now.