Does FMOD have a garbage collector?

I need to keep event instances around so I can stop music before I start a new music event. However, when working in blueprint I can only find a “Stop” method for the Event Instance, not the “Release” method that I see mentioned in the C++ API.

The issue is that as I start playing the new music event, I replace the Event Instance variable with the event instance of the new music. So I no longer have a reference to the old music event instance.

Will this unreferenced, unused event instance be cleaned up by a garbage collector once it’s clear that it’s neither playing any sounds nor being stored by any variable, or am I going to have to write C++ if I want to deallocate the memory used by the old music event instance?

1 Like

Thanks for bringing this up, FMOD will only clean up Event Instances when the System is destroyed/released, so until that point the instances will be leaking.

I have added a task to add a node for releasing Event Instances.

1 Like

Hi. Did this get added in on the 1.x branch? We are using an older version (1.10.10) but can upgrade. The sound I’m trying to fix gets spawned with ‘Play Event at Location’ then does some parameter settings before playing, so I may need to rework it if this hasn’t been added. I think there was another thread here that said if the node has Auto Play enabled that will get cleared up? If so I can probably work around the problem with those rules.

The node EventInstanceRelease was added in 1.10.15.

Using AutoPlay will also release the event when it naturally ends.

Excellent, thanks for the update.