Hello, I am reaching out due to an undesired behavior with the memory manager in Wwise 2022.1.13.
Every time a level is loaded, a large amount of objects are registered and memory allocations are triggered by the manager. When unloading the level, those same objects are unregistered and used memory is "moved to the reserves". I added a bit of code to the integration demo project to replicate this objects registration process, in a way that the objects would be registered exponentially up to a certain amount, then de-allocated all at once upon level termination.
The following image shows the memory management when using huge page sizes (uDeviceSpanCount and uVMSpanCount in AkMemSetings). As you can see, the used memory increases and decreases properly on each level load/unload and is consistent throughout the entire application lifetime. The reserved memory however, displays an odd behavior. It increases gradually over time, each level load bringing it closer to a certain "plateau" level, from which it starts to de-allocate the reserved memory when unloading a level.
When using medium or small pages, the reserved memory decreases every level unload, even if it still globally increases until a certain limit. The big difference here being that the maximum reserved memory level seems to be at around twice the maximum amount of used memory.
Another important detail, this was build for and tested on the Xbox Series X platform (although it also seems to happen on PC), where apparently the default page size for huge span count is 2MBs. Also, I cannot alter that value with uDevicePageSize/uVMPageSize (a bug within Wwise perhaps)?
Here are my questions:
- Is this an expected behavior? Is having twice or thrice the necessary memory reserved a necessity?
- Is there a way to customize this behavior without having to re-write the entire memory manager?
- If not, how can I proceed to re-write it? What details should I pay attention to when implementing it? Is there any example code of documentation regarding this?