Possible Bug in AudioClip Memory Reporting?

So, this could either be a bug in how the Memory Profiler is working, or it could be a bug/limitation/known issue with AudioClips that the profiler is surfacing.

I noticed that one of our AudioClips was appearing in the Memory Profiler with a much larger than expected size (exactly 1MB). It is not a big file, and the import settings show that it should be much smaller.

I tried to reexport the file in different audio formats, changed the import settings, rename the file, etc. The profiler still reported it as taking up 1MB.

As a test, I deleted the problem file and took another capture. In this case, it now showed some other audio file as being 1MB - one that had appeared as ~30KB before I deleted the problem file.

So, I’m unsure why I always have one audio file that appears larger than it should be…it feels like inaccurate reporting, but maybe something is going on that I’m not understanding.

Below, I’ve attached a screenshot of the AudioClip section of the Memory Profiler and the import settings for the AudioClip that is listed as 1MB.

OK so technically what is happening here is that codec pool resources and other bits and pieces are allocated lazily on need. Unfortunately, when we load clips, we associate memory allocated during that load to the clip, which means that these resources get associated with one lucky clip.

So the memory usage number is correct, it’s just that it’s associated with the wrong object (it should be associated with AudioManager or specific pooling stats).

Will look into it and see if there is something we can do here.

3 Likes

Hi, did you happen to have a solution for this problem? I’ve been on a wild goose chase trying to figure out what we did wrong before stumbling on this thread. I saw this happen for the same project on both Unity 2019 and 2021.
Also repro’d it by having an empty project and dropping random sound effects into it, and building to device.

Are there any other known reporting issues that people should be aware of? We’re currently running quite close to the wire in terms of resources, so we’re relying on the numbers we’re seeing to make decisions.