# URGENT + FMOD Current Memory Problem

**URL:** <https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715>\
**Category:** FMOD Engine\
**Created:** [May 2, 2020, 6:47am UTC](https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715 "2020-05-02T06:47:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![baturalpcetin](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/baturalpcetin/32/2977_2.png) [@baturalpcetin](https://qa.fmod.com/u/baturalpcetin)\
**Post date:** [May 2, 2020, 6:47am UTC](https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715/1 "2020-05-02T06:47:19Z")

</div>

Hey guys,

1- I have a question concerning FMOD memory. Main menu FMOD current memory states 3 MB because of main menu music after that when you play game memory risen 21 mb. Everything is ok but when I go back to main menu memory is not clear, it’s hold 21. After that if you play again game it will rise 40 mb and again not clear when you go back to the main menu. How can I clear memory when not event plays.  
2- I have two event what are play same time in the game. I want to play only one. How can I do that?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 8, 2020, 4:31am UTC](https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715/2 "2020-05-08T04:31:40Z")

</div>

Are you able to share any logs you may have? Preferably showing any errors/logs before the first occurrence of the issue.

---

<div class="post-metadata">

**Author:** ![Laranor77](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Laranor77](https://qa.fmod.com/u/Laranor77)\
**Post date:** [June 7, 2021, 1:57pm UTC](https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715/3 "2021-06-07T13:57:29Z")

</div>

Hi, I’m having the same issue, and in addition to this, once I go in game again all the sounds stop and it start to crash Unity, I already updated FMOD to the 2.01.09 but still does it, I don’t always have errors logs, but I had some:  
[FMOD] assert : assertion: ‘count() == 0’ failed  
[FMOD] assert : assertion: ‘isEmpty()’ failed  
and also some of this:  
[FMOD] EventDescription::createInstance(2104736, 3551396) returned ERR\_MEMORY for STUDIO\_EVENTDESCRIPTION (0x201DA0).

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [June 11, 2021, 6:13am UTC](https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715/4 "2021-06-11T06:13:42Z")

</div>

Can you try changing the FMOD logging to level `Log` and share the entire output log when it crashes again, from either [Unity - Manual: Log Files](https://docs.unity3d.com/Manual/LogFiles.html) or the crash logs.

---

<div class="post-metadata">

**Author:** ![HangryOwlGames](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@HangryOwlGames](https://qa.fmod.com/u/HangryOwlGames)\
**Post date:** [November 15, 2021, 1:34pm UTC](https://qa.fmod.com/t/urgent-fmod-current-memory-problem/15715/5 "2021-11-15T13:34:05Z")

</div>

I know this is an older thread, but I just found this when I was looking for a solution because I hade the same error mesages.

The root cause for my issue was that I in a few cases I did the following (dummy code, not actual syntax):

// Check if I have already started my desired sound - this is within a Unity Update()  
if (instance.playbackstate is not PLAYING, STARTING or SUSTAINING)  
{  
// Create a new instance and store it in a global variable, without immediately  
// releasing it, because i might need to be able to stop/modify it  
my\_instance = create\_and\_play\_a\_new\_instance();  
}

I had this piece of code on all my enemy types. Now the events that are handled like this all have a maximum number of instances, so as soon as that maximum number was reached, the following happened:

- My code plays the event instance
- FMOD Studio stops it again, because it is stolen by a more important instance
- My code sees that the event instance is not playing and therefore starts playing a (new!) instance
- FMOD Studio stops it again, because …

This lead to a viscious circle, creating over 37k event instances. At that stage the game threw the errors mentioned above, and grinded to a halt.

I now check instance.IsValid() instead to see if _I_ already started to play an event instance (whether _FMOD_ stops the event because it’s being stolen is none of my concern).  
I also made sure that everything that runs for more than a second or two, has its stealing behaviour set to Virtualize.

Now I can do what I want to my game, and not even reach 200 instances, and stealing works perfectly.
