InAudio Documentation

Advanced Audio Plugin for Unity

User Tools

Site Tools


memory

Memory usage

To minimize memory usage all objects allocated are pooled and reused. Some of these pools can be adjusted in the InAudio Manager found in the scene or in the prefab found under InAudio/Prefabs/InAudio Manager.

To maintain hierarchy from the audio window and know when to play the next sound, coroutines are used. There are allocated a minimum of 48 bytes when playing a sound and an extra 24 bytes for each additional node.
For instance will playing a simple sound be 48 bytes.
Playing a random sound will be 72 bytes. 24 byte overhead + 24 for the random node + 24 for the audio.
Loops, delays will each add 24 bytes each. Research is being done for how to get rid of coroutines.

To keep track of which sounds belong to what objects a dictionary is used, this will allocate some objects (which of course are pooled). To make sure that this list does not keep growing, it is recommended to call the method InAudio.Cleanup() from time to time.

For InAudio to allocate one megabyte of memory, more than 20.000 times sounds can be played.

Running the memory profiler in the editor does not represent standalone memory usage. Both for audio memory use and because editor script does allocate memory on demand. Build the game and attach the profiler to see a true representative.

memory.txt · Last modified: 2014/02/21 17:10 by peterolsted