MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / freeRam

Function freeRam

Arduino/libraries/ST_Anything/Everything.cpp:365–381  ·  view source on GitHub ↗

freeRam() function - useful in determining how much SRAM is available on Arduino

Source from the content-addressed store, hash-verified

363
364//freeRam() function - useful in determining how much SRAM is available on Arduino
365long freeRam()
366{
367#if defined(ARDUINO_ARCH_AVR)
368 extern int __heap_start, *__brkval;
369 int v;
370 return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int)__brkval);
371#elif defined(ARDUINO_ARCH_ESP8266)
372 return ESP.getFreeHeap();
373#elif defined(ARDUINO_ARCH_SAMD)
374 char top;
375 return &top - reinterpret_cast<char*>(sbrk(0));
376#else
377 return -1;
378#endif // !
379
380
381}
382

Callers 5

initMethod · 0.85
initDevicesMethod · 0.85
runMethod · 0.85
addSensorMethod · 0.85
addExecutorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected