version 2.8
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.org/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 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21  #if GFX_OS_HEAP_SIZE != 0 || defined(__DOXYGEN__)
22  /**
23  * @brief Take a chunk of memory and add it to the available heap
24  * @note Memory added must obviously not already be on the heap.
25  * @note It is allowable to add multiple non-contiguous blocks of memory
26  * to the heap. If however it is contiguous with a previously added block
27  * it will get merged with the existing block in order to allow
28  * allocations that span the boundary.
29  * @pre GFX_OS_HEAP_SIZE != 0 and an operating system that uses the
30  * internal ugfx heap allocator rather than its own allocator.
31  */
32  void gfxAddHeapBlock(void *ptr, size_t sz);
33  #endif
34 
35  void *gfxAlloc(size_t sz);
36  void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
37  void gfxFree(void *ptr);
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 
43 #endif /* GOS_NEED_X_HEAP */
44 #endif /* _GOS_X_HEAP_H */
void * gfxAlloc(size_t sz)
Allocate memory.
void * gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
Re-allocate memory.
void gfxFree(void *ptr)
Free memory.