Introduces a new define HEAP_DEBUG_MESSAGE(location) that can be used to instrument the code to get heap information output on the Serial output. It can be enabled via the define ENABLE_HEAP_DEBUGGING. Also fixes some memory leaks in the website part of the project.
12 lines
397 B
C
12 lines
397 B
C
#include <Arduino.h>
|
|
|
|
|
|
#ifdef ENABLE_HEAP_DEBUGGING
|
|
#define HEAP_DEBUG_MESSAGE(location) printHeapDebugData(location);
|
|
#else
|
|
#define HEAP_DEBUG_MESSAGE(location)
|
|
#endif
|
|
|
|
inline void printHeapDebugData(String location){
|
|
Serial.println("Heap: " + String(ESP.getMinFreeHeap()/1024) + "\t" + String(ESP.getFreeHeap()/1024) + "\t" + String(ESP.getMaxAllocHeap()/1024) + "\t" + location);
|
|
} |