µGFX  2.9
version 2.9
gos_x_heap.h
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 #ifndef _GOS_X_HEAP_H
9 #define _GOS_X_HEAP_H
10 
11 #if GOS_NEED_X_HEAP || defined(__DOXYGEN__)
12 
13 /*===========================================================================*/
14 /* Type definitions */
15 /*===========================================================================*/
16 
17 #if GFX_OS_HEAP_SIZE != 0 || defined(__DOXYGEN__)
18  /**
19  * @brief Take a chunk of memory and add it to the available heap
20  * @note Memory added must obviously not already be on the heap.
21  * @note It is allowable to add multiple non-contiguous blocks of memory
22  * to the heap. If however it is contiguous with a previously added block
23  * it will get merged with the existing block in order to allow
24  * allocations that span the boundary.
25  * @pre GFX_OS_HEAP_SIZE != 0 and an operating system that uses the
26  * internal ugfx heap allocator rather than its own allocator.
27  */
28  void gfxAddHeapBlock(void *ptr, gMemSize sz);
29 #endif
30 
31 void *gfxAlloc(gMemSize sz);
32 void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
33 void gfxFree(void *ptr);
34 
35 #endif /* GOS_NEED_X_HEAP */
36 #endif /* _GOS_X_HEAP_H */
void * gfxAlloc(gMemSize sz)
Allocate memory.
void * gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz)
Re-allocate memory.
void gfxFree(void *ptr)
Free memory.