Version
menu_open
Wwise SDK 2019.2.15
Memory Manager

All modules of the Wwise sound engine access memory through the AK::MemoryMgr interface. The client of the sound engine is responsible for initializing and terminating this interface.

A default implementation is provided with the SDK as a static library (AkMemoryMgr.lib). To use this library, the client needs to include the AkModule.h header, and call the AK::MemoryMgr::Init initialization function.

Refer to Build Configuration for more information regarding the usage of AkMemoryMgr.lib and other libraries.

Initialization

In the default implementation, default initialization settings can be obtained using AK::MemoryMgr::GetDefaultSettings.

Use the following setting to limit the total amount of virtual and device memory allocated by the Memory Manager:

Use the following settings to perform tracking of allocations for debugging purposes (these will not be called in the Release configuration):

The debug functions above do not replace the actual allocation functions below; they are notification callbacks for the various memory allocation events.

Use the following settings to override the default implementation's use of rpmalloc with a custom allocator:

It is important for the allocation functions above to honor the AkMemType_Device bit by returning device memory when the bit is set. Device memory allocation is used on certain platforms only, and must conform to specific parameters: refer to the platform-specific section for details.

On PS5, it is critical to return device memory pages protected with additional flags. Refer to Memory Mapping Requirements for details on how to properly implement device memory allocation functions on PS5.

On Xbox One, it is critical to return memory pages allocated with APU functions. Refer to APU Memory for details on how to properly implement device memory allocation functions on Xbox One.

On Xbox Series X, it is critical to return memory pages allocated with APU functions. Refer to APU Memory for details on how to properly implement device memory allocation functions on Xbox Series X.

Use the following settings to override the page allocation mechanism underlying rpmalloc:

The functions above will not be called if a custom allocator is configured to override rpmalloc. Device memory allocation is used on certain platforms only, and must conform to specific parameters: refer to the platform-specific section for details. If the alignment of the returned memory does not correspond to the natural alignment of the platform (for example, 64KB on Windows), this custom alignment must be specified in uVMPageSize and uDevicePageSize.

Refer to Samples for sample code and more information regarding the initialization of the Memory Manager in your game.

Refer to Loading Banks for more information regarding SoundBank memory usage.

Refer to Optimizing Memory Allocation for information about optimizing memory allocation.

Overriding the memory manager

It is possible for a client to provide a custom implementation of the AK::MemoryMgr interface. All functions defined in AkMemoryMgr.h should be implemented. The functions from the AK::MemoryMgr namespace defined in AkModule.h do not need to be implemented as they are specific to the default implementation of the memory manager.

As when overriding the various allocation functions of AkMemSettings, when writing a new AK::MemoryMgr implementation care must be taken to honor the AkMemType_Device bit by returning device memory when the bit is set. Device memory allocation is used on certain platforms only, and must conform to specific parameters: refer to the platform-specific section for details.


Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell 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