#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
◆ SHINYALLOCATOR_ALIGNMENT
#define SHINYALLOCATOR_ALIGNMENT (sizeof(void *) * 4U) |
Memory alignment based on platform pointer (8/16/32)
◆ SHINYALLOCATOR_VERSION_MAJOR
#define SHINYALLOCATOR_VERSION_MAJOR 1 |
◆ SHINYALLOCATOR_VERSION_MINOR
#define SHINYALLOCATOR_VERSION_MINOR 0 |
◆ SHINY_STATUS
◆ shinyAllocatorInstance
encapsulation of the structure instance
◆ shinyAllocatorThreadSafeInstance
◆ shinyAllocate()
Allocated the requested memory to the given the pool handle, returns NULL if it fails.
- Parameters
-
handle | allocater handle to the pool. |
size | the requested allocation size. |
- Note
- may cause integer-overflow for bigger sizes. It's recommended keep overall allocated bytes less than SIZE_MAX/2-1.
◆ shinyAllocateThreadSafe()
Allocates memory from a thread-safe shinyAllocator instance.
- Parameters
-
threadSafeHandle | Thread-safe shinyAllocator instance. |
amount | Amount of memory to allocate. |
- Returns
- Pointer to the allocated memory.
◆ shinyDeinitThreadSafe()
Deinitializes a thread-safe shinyAllocator instance.
- Parameters
-
◆ shinyFree()
Frees the memory allocated to the given the pool handle.
- Parameters
-
handle | allocator handle to the pool. |
pointer | pointer to the allocated memory. |
◆ shinyFreeThreadSafe()
Frees memory allocated by a thread-safe shinyAllocator instance.
- Parameters
-
threadSafeHandle | Thread-safe shinyAllocator instance. |
pointer | Pointer to the memory to be freed. |
◆ shinyGetDiagnostics()
- Parameters
-
- Returns
- current diagnostics
◆ shinyGetDiagnosticsThreadSafe()
Thread-safe wrapper for shinyGetDiagnostics().
- Parameters
-
threadSafeHandle | Thread-safe shinyAllocator instance. |
- Returns
- Diagnostics for the shinyAllocator instance.
◆ shinyInit()
Initializes the shinyAllocator for the given base pointer and size.
- Parameters
-
base | base pointer for the pool, it should be aligned to SHINYALLOCATOR_ALIGNMENT. |
size | size of the pool, this parameter should not exceed SIZE_MAX/2. |
allocator occupy 40+ bytes (up to 600 bytes depending on architecture) of the pool for holding its configuration.
- Returns
- NULL if the pool is not sufficient for the given size otherwise returns a pointer to the newly initialized allocator.
- Note
- An initialized any resources, hence you can discard it without any de-initialization if it is not needed.
◆ shinyInitThreadSafe()
Initializes a thread-safe shinyAllocator instance.
- Parameters
-
base | Base address for the shinyAllocator instance. |
size | Size of the shinyAllocator instance. |
- Returns
- Thread-safe shinyAllocator instance.
◆ sizeof_shinyAllocatorInstance()
size_t sizeof_shinyAllocatorInstance |
( |
void |
| ) |
|
◆ sizeof_shinyAllocatorThreadSafeInstance()
size_t sizeof_shinyAllocatorThreadSafeInstance |
( |
void |
| ) |
|