Closed pschraut closed 6 years ago
Another great catch, Peter! We're currently looking into this. Should be fixed by the next update.
Thanks!
I'd like to also point out that this method call also creates 56b per-frame GC alloc overhead. Noticed with with deep profiling (tested with Editor playmode, not actual build yet):
AudioSettings.GetSpatializerPluginName()
String concat or such, maybe? Should be avoidable allocations.
ResonanceAudioRoomManager.UpdateRoom() is called by ResonanceAudioRoom(s). The method allocates a RoomEffectsRegion object every call, causing garbage memory to be created.
It's recommended to write per-frame allocation free code, if performance is a concern, such as in interactive applications that have to run at 60 or 90 frames per second.
Reproduce
Observe in "CPU Usage" profiler that ResonanceAudioRoom.Update() allocates 224 bytes every frame. It's tracked in the "GC Alloc" column.
Expected Code that runs every frame should not allocate memory, which causes GC collection eventually.
There are other methods in ResonanceAudioRoomManager that cause GC allocs as well, such as "RemoveRoom". Ideally, these should also cause no allocations.