1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Update freeMemory.cpp

Add explanatory comment.
This commit is contained in:
Neil McKechnie 2021-03-10 10:33:42 +00:00
parent eb54c78d74
commit 0b3c0bfe9e

View File

@ -49,6 +49,11 @@ static inline int freeMemory() {
// Update low ram level. Allow for extra bytes to be specified // Update low ram level. Allow for extra bytes to be specified
// by estimation or inspection, that may be used by other // by estimation or inspection, that may be used by other
// called subroutines. Must be called with interrupts disabled. // called subroutines. Must be called with interrupts disabled.
//
// Although __brkval may go up and down as heap memory is allocated
// and freed, this function records only the worst case encountered.
// So even if all of the heap is freed, the reported minimum free
// memory will not increase.
// //
void updateMinimumFreeMemory(unsigned char extraBytes) { void updateMinimumFreeMemory(unsigned char extraBytes) {
int spare = freeMemory()-extraBytes; int spare = freeMemory()-extraBytes;