MiniGUI maintains some private block data heaps to allocate data blocks which have fixed size, such as the clipping rectangles in a region. By using the private heap, we can avoiding calling malloc and free function frequently, so will have a slight performance enhancement.
More...
MiniGUI maintains some private block data heaps to allocate data blocks which have fixed size, such as the clipping rectangles in a region. By using the private heap, we can avoiding calling malloc and free function frequently, so will have a slight performance enhancement.
◆ BLOCKHEAP
◆ PBLOCKHEAP
Data type of the pointer to a BLOCKHEAP.
- See also
- BLOCKHEAP
Definition at line 614 of file gdi.h.
◆ BlockDataAlloc()
Allocates a data block from private heap.
This function allocates a data block from an initialized block data heap. The allocated block will have the size of heap->bd_size. If there is no free block in the heap, this function will try to allocate the block from the system heap by using malloc(3) function.
- Parameters
-
heap | The pointer to the initialized heap. |
- Returns
- Pointer to the allocated data block, NULL on error.
- See also
- InitBlockDataHeap, BlockDataFree
◆ BlockDataFree()
void BlockDataFree |
( |
PBLOCKHEAP |
heap, |
|
|
void * |
data |
|
) |
| |
Frees an allocated data block.
This function frees the specified data block pointed to by data to the heap heap. If the block was allocated by using malloc function, this function will free the element by using free(3) function.
- Parameters
-
heap | The pointer to the heap. |
data | The pointer to the element to be freed. |
- See also
- InitBlockDataHeap, BlockDataAlloc
◆ DestroyBlockDataHeap()
◆ InitBlockDataHeap()
BOOL InitBlockDataHeap |
( |
PBLOCKHEAP |
heap, |
|
|
size_t |
bd_size, |
|
|
size_t |
heap_size |
|
) |
| |
Initializes a private block data heap.
This function initializes a block data heap pointed to by heap. It will allocate the buffer used by the heap from system heap by using malloc(3). Initially, the heap has heap_size blocks free, and each is bd_size bytes long.
- Parameters
-
heap | The pointer to the heap structure. |
bd_size | The size of one block in bytes. |
heap_size | The size of the heap in blocks. |
- Returns
- TRUE on success, FALSE on error.
- See also
- BLOCKHEAP