Shared Persistent Heap Data Environment Manual
1.1.0
|
Shared Address Space Simple Heap. More...
#include "sastype.h"
Go to the source code of this file.
Typedefs | |
typedef void * | SASSimpleHeap_t |
Handle to SAS Simple Space. The type is SAS_RUNTIME_SIMPLEHEAP. | |
Functions | |
__C__ SASSimpleHeap_t | SASSimpleHeapInit (void *heap_block, sas_type_t sasType, block_size_t heap_size) |
Initialize a shared storage as a simple heap. More... | |
__C__ SASSimpleHeap_t | SASSimpleHeapCreate (block_size_t heap_size) |
Allocate a SAS block large enough to contain the requested SAS Simple Heap. More... | |
__C__ int | SASSimpleHeapDestroy (SASSimpleHeap_t heap) |
Destroy a SASSimpleHeap_t and free the shared storage block. More... | |
__C__ block_size_t | SASSimpleHeapFreeSpace (SASSimpleHeap_t heap) |
Return the available space from Simple Heap heap. More... | |
__C__ int | SASSimpleHeapEmpty (SASSimpleHeap_t heap) |
Return if the Simple Heap heap has no space left. More... | |
__C__ void * | SASSimpleHeapAlloc (SASSimpleHeap_t heap, block_size_t alloc_size) |
Allocate a block of alloc_size bytes from Simple Heap heap. More... | |
__C__ int | SASSimpleHeapFree (SASSimpleHeap_t heap, void *free_block, block_size_t alloc_size) |
Deallocate the memory block free_block of size alloc_size from Simple Heap heap. More... | |
__C__ SASSimpleHeap_t | SASSimpleHeapNearFind (void *nearObj) |
Find the associate SASSimpleHeap_t control block near nearObj. More... | |
__C__ void * | SASSimpleHeapNearAlloc (void *nearObj, long allocSize) |
Allocate a block of alloc_size bytes from Simple Heap nearObj. More... | |
__C__ void | SASSimpleHeapNearDealloc (void *memAddr, long allocSize) |
Deallocate the memory block memAddr of size allocSize. More... | |
__C__ int | SASSimpleHeapDestroyNoLock (SASSimpleHeap_t heap) |
Destroy a SASSimpleHeap_t and free the shared storage block. More... | |
__C__ block_size_t | SASSimpleHeapFreeSpaceNoLock (SASSimpleHeap_t heap) |
Return the available space from Simple Heap heap. More... | |
__C__ void * | SASSimpleHeapAllocNoLock (SASSimpleHeap_t heap, block_size_t alloc_size) |
Allocate a block of alloc_size bytes from Simple Heap heap. More... | |
__C__ int | SASSimpleHeapFreeNoLock (SASSimpleHeap_t heap, void *free_block, block_size_t alloc_size) |
Deallocate the memory block free_block of size alloc_size from Simple Heap heap. More... | |
__C__ void * | SASSimpleHeapNearAllocNoLock (void *nearObj, long allocSize) |
Allocate a block of allocSize bytes from Simple Heap heap. More... | |
__C__ void | SASSimpleHeapNearDeallocNoLock (void *memAddr, long allocSize) |
Deallocate the memory block memAddr of size allocSize. More... | |
__C__ int | SASSimpleHeapEmptyNoLock (SASSimpleHeap_t heap) |
Return if the Simple Heap heap has not space left. More... | |
Shared Address Space Simple Heap.
Allocate a SAS block to be used as an heap using its internal functions to allocate/deallocate objects. The heap is created with function SASSimpleHeapCreate and destroyed with SASSimpleHeapDestroy. Objects are allocated with function SASSimpleHeapAlloc, SASSimpleHeapNearAlloc, and with their NoLock variants. The objects are freed using SASSimpleHeapFree, SASSimpleHeapNearDealloc, and with their NoLock variants.
__C__ void* SASSimpleHeapAlloc | ( | SASSimpleHeap_t | heap, |
block_size_t | alloc_size | ||
) |
Allocate a block of alloc_size bytes from Simple Heap heap.
The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. The functions holds an exclusive write while reading the empty spaces from heap object.
heap | Handle of a SAS Simple Heap. |
alloc_size | Size in byte to allocate. |
__C__ void* SASSimpleHeapAllocNoLock | ( | SASSimpleHeap_t | heap, |
block_size_t | alloc_size | ||
) |
Allocate a block of alloc_size bytes from Simple Heap heap.
Similar to SASSimpleHeapAlloc but do not hold any write lock.
heap | Handle of a SAS Simple Heap. |
alloc_size | Size in byte to allocate. |
__C__ SASSimpleHeap_t SASSimpleHeapCreate | ( | block_size_t | heap_size | ) |
Allocate a SAS block large enough to contain the requested SAS Simple Heap.
Create and initialize a Simple Heap. The storage block must be power of two in size and SAS type returned is SAS_RUNTIME_SIMPLEHEAP.
heap_size | Size of the Simple Heap to create. |
__C__ int SASSimpleHeapDestroy | ( | SASSimpleHeap_t | heap | ) |
Destroy a SASSimpleHeap_t and free the shared storage block.
The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. Destroy holds an exclusive lock write while clearing the control blocks and freeing the SAS block.
heap | Handle of the SASSimpleHeap_t to be destroyed. |
__C__ int SASSimpleHeapDestroyNoLock | ( | SASSimpleHeap_t | heap | ) |
Destroy a SASSimpleHeap_t and free the shared storage block.
Similar to SASSimpleHeapDestroy but do not hold any write lock.
heap | handle of the SASSimpleHeap_t to be destroyed. |
__C__ int SASSimpleHeapEmpty | ( | SASSimpleHeap_t | heap | ) |
Return if the Simple Heap heap has no space left.
The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. The functions holds an exclusive write while reading the empty spaces from heap object.
heap | Handle of a SAS Simple Heap. |
__C__ int SASSimpleHeapEmptyNoLock | ( | SASSimpleHeap_t | heap | ) |
Return if the Simple Heap heap has not space left.
Similar to SASSimpleHeapEmpty but do not hold any write lock.
heap | Handle of a SAS Simple Heap. |
__C__ int SASSimpleHeapFree | ( | SASSimpleHeap_t | heap, |
void * | free_block, | ||
block_size_t | alloc_size | ||
) |
Deallocate the memory block free_block of size alloc_size from Simple Heap heap.
The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. The functions holds an exclusive write while freeing the allocated block from heap.
heap | Handle of a SAS Simple Heap. |
free_block | Memory block previously allocated using SASSimpleHeapAlloc function. |
alloc_size | Size in bytes of the allocated block size. |
__C__ int SASSimpleHeapFreeNoLock | ( | SASSimpleHeap_t | heap, |
void * | free_block, | ||
block_size_t | alloc_size | ||
) |
Deallocate the memory block free_block of size alloc_size from Simple Heap heap.
Similar to SASSimpleHeapFree but do not hold any lock.
heap | Handle of a SAS Simple Heap. |
free_block | Memory block previously allocated using SASSimpleHeapAlloc function. |
alloc_size | Size in bytes of the allocated block size. |
__C__ block_size_t SASSimpleHeapFreeSpace | ( | SASSimpleHeap_t | heap | ) |
Return the available space from Simple Heap heap.
The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. The functions holds an exclusive write while reading the empty spaces from heap object.
heap | Handle of a SAS Simple Heap. |
__C__ block_size_t SASSimpleHeapFreeSpaceNoLock | ( | SASSimpleHeap_t | heap | ) |
Return the available space from Simple Heap heap.
Similar to SASSimpleHeapFreeSpace but do not hold any write lock.
heap | Handle of a SAS Simple Heap. |
__C__ SASSimpleHeap_t SASSimpleHeapInit | ( | void * | heap_block, |
sas_type_t | sasType, | ||
block_size_t | heap_size | ||
) |
Initialize a shared storage as a simple heap.
Initialize the control blocks within the specified storage block as a Simple Heap. The store block must be power of two in size and have the same power of two (or better) alignment. The SAS type created is SAS_RUNTIME_SIMPLEHEAP.
heap_block | Block of allocated SAS storage. |
sasType | Type of SAS object (should contain SAS_SIMPLEHEAP_TYPE type). |
heap_size | Size of the simple heap within the block. |
__C__ void* SASSimpleHeapNearAlloc | ( | void * | nearObj, |
long | allocSize | ||
) |
Allocate a block of alloc_size bytes from Simple Heap nearObj.
The address nearObj is used to find the associated Simple Heap object. The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. The functions holds an exclusive write while allocating from heap.
nearObj | Handle of a SAS Simple Heap. |
allocSize | Size in byte to allocate. |
__C__ void* SASSimpleHeapNearAllocNoLock | ( | void * | nearObj, |
long | allocSize | ||
) |
Allocate a block of allocSize bytes from Simple Heap heap.
Similar to SASSimpleHeapNearAlloc but do not hold any write lock.
nearObj | Handle of a SAS Simple Heap. |
allocSize | Size in byte to allocate. |
__C__ void SASSimpleHeapNearDealloc | ( | void * | memAddr, |
long | allocSize | ||
) |
Deallocate the memory block memAddr of size allocSize.
The address memAddr is used to find the associated Simple Heap object. The sas_type_t must be SAS_RUNTIME_SIMPLEHEAP. The functions holds an exclusive write while reading the empty spaces from heap object.
memAddr | Handle of a SAS Simple Heap. |
allocSize | Size in bytes of the allocated block size. |
__C__ void SASSimpleHeapNearDeallocNoLock | ( | void * | memAddr, |
long | allocSize | ||
) |
Deallocate the memory block memAddr of size allocSize.
Similar to SASSimpleHeapNearDealloc but do not hold any write lock.
memAddr | Handle of a SAS Simple Heap. |
allocSize | Size in bytes of the allocated block size. |
__C__ SASSimpleHeap_t SASSimpleHeapNearFind | ( | void * | nearObj | ) |
Find the associate SASSimpleHeap_t control block near nearObj.
nearObj | Handle of a SAS Simple Heap. |