-
Notifications
You must be signed in to change notification settings - Fork 13
Memory functions
This category contains functions for allocating/manipulating memory. More...
| Type | Name |
|---|---|
| struct |
fplMemoryBlock Stores properties that represents any block of memory. More... |
| struct |
fplMemoryInfos Stores information about the current memory usage. More... |
| Type | Name |
|---|---|
| fpl_common_api void * |
fplMemoryAlignedAllocate (const size_t size, const size_t alignment) Allocates aligned memory from the operating system by the given alignment. |
| fpl_common_api void |
fplMemoryAlignedFree (void *ptr) Releases the aligned memory allocated from the operating system. |
| fpl_platform_api void * |
fplMemoryAllocate (const size_t size) Allocates memory from the operating system by the given size, that is aligned to the operating systems page-size (most common is 64 KB). |
| fpl_common_api void |
fplMemoryClear (void *mem, const size_t size) Clears the given memory by the given size to zero. |
| fpl_common_api void |
fplMemoryCopy (const void *sourceMem, const size_t sourceSize, void *targetMem) Copies the given source memory with its length to the target memory. |
| fpl_platform_api void |
fplMemoryFree (void *ptr) Releases the memory allocated from the operating system. |
| fpl_platform_api bool |
fplMemoryGetUsage (fplMemoryInfos *outInfos) Retrieves the current system memory usage. |
| fpl_common_api void |
fplMemorySet (void *mem, const uint8_t value, const size_t size) Sets the given memory by the given size to the given value. |
This category contains functions for allocating/manipulating memory.
fpl_common_api void * fplMemoryAlignedAllocate ( const size_t size, const size_t alignment )Allocates aligned memory from the operating system by the given alignment.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | size | The size amount in bytes. |
| [in] | alignment | The alignment in bytes (must be a power-of-two). |
Returns: Reference to the new allocated aligned memory.
Note: The memory is guaranteed to be initialized to zero.
This function can be called without the platform to be initialized.
fpl_common_api void fplMemoryAlignedFree ( void * ptr)Releases the aligned memory allocated from the operating system.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | ptr | Reference to the aligned allocated memory. |
Warning: This should never be called with a not-aligned memory reference! For freeing not-aligned memory, use
fplMemoryFree() instead.
Note: This function can be called without the platform to be initialized.
See also: Free aligned memory
fpl_platform_api void * fplMemoryAllocate ( const size_t size)Allocates memory from the operating system by the given size, that is aligned to the operating systems page-size (most common is 64 KB).
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | size | The size to be allocated in bytes. |
Returns: Reference to the newly allocated memory.
Warning: Alignment is not ensured here, the OS decides how to handle this. If you want to force a specific alignment use
fplMemoryAlignedAllocate() instead.
Note: The memory is guaranteed to be initialized to zero.
This function can be called without the platform to be initialized.
See also: Allocate (n)-bytes of memory
fpl_common_api void fplMemoryClear ( void * mem, const size_t size )Clears the given memory by the given size to zero.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | mem | Reference to the target memory. |
| [in] | size | The number of bytes to be cleared to zero (size_t). |
See also: Clear (n)-bytes of memory
fpl_common_api void fplMemoryCopy ( const void * sourceMem, const size_t sourceSize, void * targetMem )Copies the given source memory with its length to the target memory.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | sourceMem | Reference to the source memory to copy from. |
| [in] | sourceSize | The size in bytes to be copied. |
| [out] | targetMem | Reference to the target memory to copy into. |
See also: Copy (n)-bytes of memory to another memory location
fpl_platform_api void fplMemoryFree ( void * ptr)Releases the memory allocated from the operating system.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | ptr | Reference to the allocated memory. |
Warning: This should never be called with an aligned memory reference! For freeing aligned memory, use
fplMemoryAlignedFree() instead.
Note: This function can be called without the platform to be initialized.
See also: Free memory
fpl_platform_api bool fplMemoryGetUsage ( fplMemoryInfos * outInfos)Retrieves the current system memory usage.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [out] | outInfos | Reference to the target structure fplMemoryInfos. |
Returns: Returns true when the memory info was retrieved, false otherwise.
See also: Query memory state
fpl_common_api void fplMemorySet ( void * mem, const uint8_t value, const size_t size )Sets the given memory by the given size to the given value.
Parameters
| Direction | Parameter | Description |
|---|---|---|
| [in] | mem | Reference to the target memory. |
| [in] | value | The value to be set. |
| [in] | size | The number of bytes to be set. |
- Assertion & Debug
- Atomic operations
- Audio functions
- Clipboard functions
- Console functions
- Constants
- Display/Monitor functions
- Dynamic library loading
- Error Handling
- Files/IO functions
- Function macros
- Hardware Infos
- Input types and functions
- Localization functions
- Logging
- Memory Macros
- Memory functions
- Operating system Infos
- Path functions
- Platform functions
- Session Infos
- Settings & Configurations
- Storage class identifiers
- String functions
- Threading and synchronizations routines
- Timing functions
- Video functions
- Window events
- Window functions
- fplARMCPUCapabilities
- fplAudioChannelMap
- fplAudioDeviceID
- fplAudioDeviceInfo
- fplAudioFormat
- fplAudioSettings
- fplColor32
- fplConditionVariable
- fplConsoleSettings
- fplCPUCapabilities
- fplCPUIDLeaf
- fplDateTime
- fplDateTimeCreationResult
- fplDateTimeResult
- fplDisplayInfo
- fplDisplayMode
- fplDynamicLibraryHandle
- fplEndianess
- fplEvent
- fplFileEntry
- fplFileHandle
- fplFilePermissions
- fplFileTimeStamps
- fplGamepadButton
- fplGamepadData
- fplGamepadEvent
- fplGamepadInfo
- fplGamepadInputBinding
- fplGamepadMapping
- fplGamepadSettings
- fplGamepadState
- fplGamepadStates
- fplGraphicsApiSettings
- fplImageSource
- fplInputBackendMask
- fplInputBackendSupport
- fplInputDevice
- fplInputDeviceGuid
- fplInputSettings
- fplInternalConditionVariable
- fplInternalDynamicLibraryHandle
- fplInternalFileEntryHandle
- fplInternalFileHandle
- fplInternalFileRootInfo
- fplInternalMutexHandle
- fplInternalSemaphoreHandle
- fplInternalSignalHandle
- fplInternalThreadHandle
- fplKeyboardEvent
- fplKeyboardState
- fplLogSettings
- fplLogWriter
- fplLogWriterConsole
- fplLogWriterCustom
- fplMemoryAllocationSettings
- fplMemoryBlock
- fplMemoryInfos
- fplMemorySettings
- fplMouseEvent
- fplMouseState
- fplMutexHandle
- fplOpenGLSettings
- fplOSVersionInfos
- fplSemaphoreHandle
- fplSettings
- fplSignalHandle
- fplSpecificAudioSettings
- fplThreadHandle
- fplThreadParameters
- fplTimestamp
- fplVersionInfo
- fplVideoBackBuffer
- fplVideoRect
- fplVideoRequirements
- fplVideoRequirementsVulkan
- fplVideoSettings
- fplVideoSurface
- fplVideoSurfaceOpenGL
- fplVideoSurfaceVulkan
- fplVideoWindow
- fplVulkanSettings
- fplWindowCallbacks
- fplWindowDropFiles
- fplWindowEvent
- fplWindowPosition
- fplWindowSettings
- fplWindowSize
- fplX86CPUCapabilities