AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
MemUtils.h
Go to the documentation of this file.
1 /*
2  MemUtils.h - Memory-related utilities
3  For AVR ATMega328p (Arduino Uno) and ATMega2560 (Arduino Mega).
4  This is part of the AVRTools library.
5  Copyright (c) 2014 Igor Mikolic-Torreira. All right reserved.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 
36 #ifndef MemUtils_h
37 #define MemUtils_h
38 
39 #include <stddef.h>
40 
45 namespace MemUtils
46 {
47 
59  size_t freeSRAM();
60 
61 
62 
74 
75 
76 
86  void resetHeap();
87 
88 
89 
103  size_t memoryAvailableOnFreeList();
104 
105 
106 
124  size_t getFreeListStats( int* nbrBlocks, size_t* sizeSmallestBlock, size_t* sizeLargestBlock );
125 
126 };
127 
128 #endif
size_t memoryAvailableOnFreeList()
Get the free memory on the heap free-list.
Definition: MemUtils.cpp:60
void resetHeap()
Reset the heap to an empty (virgin) state.
Definition: MemUtils.cpp:163
size_t getFreeListStats(int *nbrBlocks, size_t *sizeSmallestBlock, size_t *sizeLargestBlock)
Get information about the heap free-list.
Definition: MemUtils.cpp:78
A namespace providing encapsulation for functions that report the available memory in SRAM...
Definition: MemUtils.h:45
size_t freeMemoryBetweenHeapAndStack()
Get the free memory between the heap and the stack.
Definition: MemUtils.cpp:141
size_t freeSRAM()
Get the total free memory remaining in SRAM.
Definition: MemUtils.cpp:118