Wwise SDK
_ak_memory_mgr_8h_source
Version
menu_open
Wwise SDK 2023.1.6
|
AkMemoryMgr.h
Go to the documentation of this file.
74 };
111 AkUInt64 uReserved; ///< Total reserved memory. (Used and unused). Will return 0 if the reserved memory is not traceable.
112 AkUInt64 uMax; ///< Maximum total allocation size, specified in the initialization settings through uMemAllocationSizeLimit. Will be 0 if no limit was set.
120 /// \warning This function is not thread-safe. It should not be called at the same time as MemoryMgr::Init or MemoryMgr::Term.
128 /// \warning This function is not thread-safe. It is not valid to allocate memory or otherwise interact with the memory manager during or after this call.
133 /// Performs whatever steps are required to initialize a thread for use with the memory manager.
135 /// The default implementation of the memory manager performs thread initialization automatically and therefore this call is optional.
136 /// For implementations where the cost of automatically initializing a thread for use with an allocator would be prohibitively expensive
137 /// this call allows you to perform the initialization once during, for example, thread creation.
143 /// The default implementation of the memory manager requires that all threads that interact with the memory manager call this function prior
144 /// to either their termination or the termination of the memory manager. Threads not created by the sound engine itself will not have this
146 /// Take care to call this function for any thread, not owned by wwise, that may have interacted with the memory manager. For example job system workers.
153 /// so that any thread-local state can be cleaned up in order to return memory for other systems to use.
154 /// For example, this can be used to return thread-local heaps to global stores or to finalize other deferred operations.
156 /// Therefore, unlike TermForThread, this is not expected to be called in all scenarios by Wwise.
157 /// It is also recommended to be called by game engine integrations in any worker threads that run Wwise jobs.
171 /// \return A pointer to the start of the allocated memory (NULL if the allocation could not be completed)
183 /// \return A pointer to the start of the allocated memory (NULL if the allocation could not be completed)
193 /// \return A pointer to the start of the reallocated memory (NULL if the allocation could not be completed)
206 /// \return A pointer to the start of the reallocated memory (NULL if the allocation could not be completed)
217 /// \return A pointer to the start of the reallocated memory (NULL if the allocation could not be completed)
231 /// \return A pointer to the start of the reallocated memory (NULL if the allocation could not be completed)
251 /// \return A pointer to the start of the allocated memory (NULL if the allocation could not be completed)
264 /// \return A pointer to the start of the allocated memory (NULL if the allocation could not be completed)
280 /// \note Be aware of the potentially incoherent nature of reporting such information during concurrent modification by multiple threads.
287 /// \note Be aware of the potentially incoherent nature of reporting such information during concurrent modification by multiple threads.
293 /// \note Not implementing this will result in the Soundbank tab of the Wwise Profiler to show 0 bytes for memory usage.
298 /// \return The amount of memory allocated by this thread since StartProfileThreadUsage was called.
299 /// \note Not implementing this will result in the Soundbank tab of the Wwise Profiler to show 0 bytes for memory usage.
304 /// \note AkMemSettings::uMemoryDebugLevel must be enabled and the build must define AK_MEMDEBUG for this to work
320 /// Temp-alloc memory statistics. Whenever these are fetched, they represent the last completed temp-alloc "tick".
331 AkUInt32 uPeakBlockUsed; ///< The peak amount of used memory in any single block since initialization.
341 /// Initialization settings for temporary-memory pools. Separate settings are specified for each temporary-memory pool.
344 AkUInt32 uMinimumBlockCount; ///< The number of blocks of memory the system is initialized with and is the minimum kept around forever. Defaults to 1. Higher values increase upfront memory use, but can reduce, or eliminate, the creation and destruction of memory blocks over time.
345 AkUInt32 uMinimumBlockSize; ///< The minimum size of each block. If a new allocation requests a new block of memory, then the new block is the size of the requested allocation times four, and then rounded up to the next multiple of this value. Defaults to 2MiB.
346 AkUInt32 uMaximumUnusedBlocks; ///< The maximum number of blocks that the system keeps in an unused state, and avoids freeing. Defaults to 1. Higher values do not increase the peak memory use, but do prevent unused memory from being freed, in order to reduce creation and destruction of memory blocks.
348 // Various debug options for monitoring and analyzing potential issues in usage of the TempAlloc system. All of these are ignored (treated as disabled) in Release configurations.
349 bool bDebugDetailedStats; ///< Enable to track detailed stats and include them in the detailed stat dump. Detailed stats include the size and quantity of each type of allocation from the system. Disabled by default.
350 bool bDebugClearMemory; ///< Enable to clear any allocation to a deterministic garbage value. Useful to make sure memory is initialized properly. Disabled by default.
351 bool bDebugEnableSentinels; ///< Enable to write out sentinels between most allocations to help detect memory overwrites, verified at the end of a tick. Enabled by default. Increases memory usage of blocks slightly.
352 bool bDebugFlushBlocks; ///< Enable to forcefully release all blocks at the end of a tick and recreate them from scratch every tick. Useful to ensure stale memory is not being accessed. Disabled by default. This might interfere with some stats reporting due to blocks being released between ticks.
353 bool bDebugStandaloneAllocs; ///< Enable to force the block size to be as small as possible for each allocation (smaller than can be achieved by just setting uMinimumBlockSize to very low values). Useful to investigate memory overruns in-depth, especially in conjunction with other options like bDebugFlushBlocks and the MemoryMgr's stomp allocator. If enabled, bDebugDetailedStats and bDebugEnableSentinels will be disabled. Greatly increases CPU and memory usage.
362 /// Get a detailed listing of the allocations into the temp-alloc pool, and output them to a file.
@ AkMemID_Processing
Anything tied to instancing and processing of the DSP graph.
Definition: AkMemoryMgr.h:52
AKSOUNDENGINE_API void DumpToFile(const AkOSChar *pszFilename)
AKSOUNDENGINE_API void TermForThread()
AKSOUNDENGINE_API void * dRealloc(AkMemPoolId in_poolId, void *in_pAlloc, size_t in_uSize, const char *in_pszFile, AkUInt32 in_uLine)
bool bDebugDetailedStats
Enable to track detailed stats and include them in the detailed stat dump. Detailed stats include the...
Definition: AkMemoryMgr.h:349
AkUInt32 uMinimumBlockCount
The number of blocks of memory the system is initialized with and is the minimum kept around forever....
Definition: AkMemoryMgr.h:344
AkUInt64 uDeviceUsed
Total device memory used including all categories (in bytes)
Definition: AkMemoryMgr.h:110
bool bDebugClearMemory
Enable to clear any allocation to a deterministic garbage value. Useful to make sure memory is initia...
Definition: AkMemoryMgr.h:350
AKSOUNDENGINE_API void * dMalloc(AkMemPoolId in_poolId, size_t in_uSize, const char *in_pszFile, AkUInt32 in_uLine)
@ AkMemID_Object
Generic placeholder for allocations tied to the Wwise project.
Definition: AkMemoryMgr.h:47
AKSOUNDENGINE_API void * dMalign(AkMemPoolId in_poolId, size_t in_uSize, AkUInt32 in_uAlignment, const char *in_pszFile, AkUInt32 in_uLine)
AkUInt32 uPeakBlockUsed
The peak amount of used memory in any single block since initialization.
Definition: AkMemoryMgr.h:331
AKSOUNDENGINE_API void Free(AkMemPoolId in_poolId, void *in_pMemAddress)
AKSOUNDENGINE_API void * Malloc(AkMemPoolId in_poolId, size_t in_uSize)
bool bDebugEnableSentinels
Enable to write out sentinels between most allocations to help detect memory overwrites,...
Definition: AkMemoryMgr.h:351
AKSOUNDENGINE_API void TrimForThread()
AkUInt32 uPeakBlocksUsed
The peak value for uBlocksUsed since initialization.
Definition: AkMemoryMgr.h:330
AkUInt32 uMaximumUnusedBlocks
The maximum number of blocks that the system keeps in an unused state, and avoids freeing....
Definition: AkMemoryMgr.h:346
AKSOUNDENGINE_API void Term()
AKSOUNDENGINE_API void GetGlobalStats(GlobalStats &out_stats)
AKSOUNDENGINE_API void InitForThread()
AkUInt64 uReserved
Total reserved memory. (Used and unused). Will return 0 if the reserved memory is not traceable.
Definition: AkMemoryMgr.h:111
AkUInt64 uMax
Maximum total allocation size, specified in the initialization settings through uMemAllocationSizeLim...
Definition: AkMemoryMgr.h:112
AKSOUNDENGINE_API void * dReallocAligned(AkMemPoolId in_poolId, void *in_pAlloc, size_t in_uSize, AkUInt32 in_uAlignment, const char *in_pszFile, AkUInt32 in_uLine)
AKSOUNDENGINE_API void GetStats(Type in_eType, Stats &out_stats)
Get simple statistics for a given temporary-memory pool.
AKSOUNDENGINE_API void * Malign(AkMemPoolId in_poolId, size_t in_uSize, AkUInt32 in_uAlignment)
Definition: AkModule.h:155
AKSOUNDENGINE_API void StartProfileThreadUsage()
AKSOUNDENGINE_API void * Realloc(AkMemPoolId in_poolId, void *in_pAlloc, size_t in_uSize)
AkUInt32 uPeakMemAllocated
The peak value for uMemAllocated since initialization.
Definition: AkMemoryMgr.h:329
bool bDebugStandaloneAllocs
Enable to force the block size to be as small as possible for each allocation (smaller than can be ac...
Definition: AkMemoryMgr.h:353
AKSOUNDENGINE_API AkUInt64 StopProfileThreadUsage()
Initialization settings for temporary-memory pools. Separate settings are specified for each temporar...
Definition: AkMemoryMgr.h:343
AKSOUNDENGINE_API void DumpTempAllocsToFile(Type in_eType, const AkOSChar *pszFilename)
bool bDebugFlushBlocks
Enable to forcefully release all blocks at the end of a tick and recreate them from scratch every tic...
Definition: AkMemoryMgr.h:352
Definition: AkMemoryMgr.h:91
Definition: AkMemoryMgr.h:108
AKSOUNDENGINE_API void GetCategoryStats(AkMemPoolId in_poolId, CategoryStats &out_poolStats)
AkUInt32 uMinimumBlockSize
The minimum size of each block. If a new allocation requests a new block of memory,...
Definition: AkMemoryMgr.h:345
AKSOUNDENGINE_API bool IsInitialized()
AKSOUNDENGINE_API void * ReallocAligned(AkMemPoolId in_poolId, void *in_pAlloc, size_t in_uSize, AkUInt32 in_uAlignment)
Definition: AkMemoryMgr.h:323
Was this page helpful?
Need Support?
Questions? Problems? Need more info? Contact us, and we can help!
Visit our Support pageTell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise