snipplets.dev/code/Arduino/memory/free_ram.c

7 lines
143 B
C
Raw Normal View History

2024-05-04 23:17:18 +03:00
int free_ram() {
2023-11-12 22:45:23 +03:00
extern int __heap_start, *__brkval;
int v;
2024-05-04 23:17:18 +03:00
2023-11-12 22:45:23 +03:00
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}