Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

18 lines (13 sloc) 467 Bytes
// C++ for Arduino
// What is heap fragmentation?
// https://cpp4arduino.com/
#pragma once
#include <stddef.h> // for size_t
// Returns the number of free bytes in the RAM.
size_t getTotalAvailableMemory();
// Returns the size of the largest allocable block of RAM.
size_t getLargestAvailableBlock();
// Computes the heap fragmentation percentage.
inline float getFragmentation() {
return 100 - getLargestAvailableBlock() * 100.0 / getTotalAvailableMemory();
}
You can’t perform that action at this time.