Memory issue on EHS5 | Thales IoT Developer Community
September 26, 2016 - 11:26am, 1292 views
I have a memory problem with EHS5, REVISION 03.001, A-REVISION 00.000.14.
I need to monitor network status periodically, but I observe that on every execution of an AT command the amount of free memory decreases. I have this issue with all commands I've tried (AT+CREG?, AT, ATI, for example).
After some days the free memory becomes dangerously low, although periodically the garbage collector seems to clean some kilobytes.
Furthermore, I've seen that free memory is about 13000000 bytes, but the EHS5 has only 10MB of user memory; can you explain me these numbers, please?
I paste here a code example:
while(true) { free = rt.freeMemory(); serialOut.write(("Free memory: " + free + " - Diff: " + (free-lastFreeMemory) + "\r\n").getBytes()); lastFreeMemory = free; atc.send("AT+CREG?\r"); System.gc(); Thread.sleep(5000); }
Hello,
That's how the garbage collector is working. The user application is not able to control it. It activates periodically (when the free memory is going low) and cleans all the memory that can be freed. Calling System.gc() does not guarantee that the garbage collector will run at that moment.
I've also run your code and the memory was cleared few ***** since yesterday afternoon. The initial free memory and after each cleaning there was also around 13000000 bytes.
Best regards,
Bartłomiej