Audio object does not release resources.
Attach a Capx
Description of Capx
To demonstrate my point, capx contains 8 sound effects (they are actually long audio music files)
Steps to Reproduce Bug
- 1. Run your memory monitor program such as Performance Monitor.
- 2. run capx
- 3. Press Q,W,E,R,T,Y,U,I to load and play 8 musics.
- 4. Press S to stop music. Press 1,2,3 to go other layouts if you wish.
- 5. You will see on the memory graph that loaded sounds are never released. There could be some small fluctuation of memory given the nature of Garbage Collector. Nevertheless, you will see the memory size will never drop down to where it was when it was first loaded.
Audio does not release memory. I have tested this in Node Webkit, Chrome and Firefox.
Here is memory consumption for Node Webkit. The graph rises up in the beginning because of the 8 music, but it never come back down.
This here is for Firefox. The beginning is cut off, but the result is identical.
I have tested this several times and I have also tried waiting for 30 minutes after changing layout to Layout 3. (Press 1,2,3 to change Layout in capx above) Memory did not go down, and Layout 3 is just a blank layout.
I think there should be a way for Audio object to release unused audio.
Imagine a game where each stage is themed. (ie. forest stage got wild animals sound, city stage got traffic sound, etc.) Currently, our project got 140 sound effects and about 20 musics. We have tried removing Audio object out entirely, and played through the whole game. The memory consumption is 300-400 MB after every layout has been visited. With Audio, the sounds are preloaded and played in each layout and when all layouts are visited, we got 800-900 MB. Many more audio are also coming on its way to this project, and we are afraid that with unloadable audio, this could exceed 2 GB or even more in the future. Not to mention that we also got other resources that require memory as well. Obviously, it is mandatory that we must be able to free those animal sounds when we are in the city stage and vice versa. If C2 can deallocate texture memory, then why not audio as well?
- Chrome: YES
- FireFox: YES
- Node Webkit: YES
Operating System and Service Pack
Win7 64 bits Service Pack 1
Construct 2 Version ID