Possible (consistent) memory leaks

Hi guys, I suppose there is a memory leak, which is the exact same size each time data is processed, can you help me find out where it is? ESP.getFreeHeap() returns these values (left column is the total, right is the difference with the previous:
339552
336992 2560
335608 1384
334224 1384
332840 1384
331456 1384
330072 1384
328688 1384
327304 1384
325920 1384
324536 1384

Here is the wokwi link: sketch.ino - Wokwi Arduino and ESP32 Simulator, pressing enter in the serial monitor triggers the process.

If you have other tips, please give them as I'm new to this.

I see some new and malloc statements, but no delete or free.

Yes, I tried to delete some stuff, either crashed the app or didn't make difference on the 1384 byte reduction. My assumption that it should not consistently reduce available memory is correct?

can you explain why, if you keep allocating bytes or Thermostat or LinkedList and never delete them, you expect the memory to not grow??? :roll_eyes:

(tried to run the wokwi code for 1 minute but it only printed 1 value)

Put duct tape around the ESP, it should prevent leaks.

If you keep pressing enter after each response, you'll see it printed with less bytes.

I expect that if a thermostat exists, it will be updated (and not re-created), with a max of 12, but since the packets contain 3 unique ids, it should never grow past 3. But I might have made an error/assumption here, so I hope you guys can see what I did wrong.

Insert "sounds good, doesn't work" meme here :stuck_out_tongue:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.