I’ve got a project that occasionally crashes with the following reported (I believe the issue is specifically in sound.release() or in system.update()):
fmodex64.dll caused an Access Violation (0xc0000005) in module fmodex64.dll at 0033:f25149e6.
In crash.dmp the assembly instruction at fmodex64+b49e6 in fmodex64.dll has caused an access violation exception (0xC0000005) when trying to read from memory location 0x00000000 on thread 0
Full Call Stack (from DebugDiag)
Function Arg 1 Arg 2 Arg 3 Arg 4 Source
0000003c 000000000dfbd168 00000000
I was attempting to figure out a memory leak issue which may/may not have been caused by fmod when this started happening from my adjusted code (listed below). My question is – has anyone seen this before (specifically an fmod god or someone who’s resolved it :-P), and additionally, what is the best way to manage the following scenario from a memory standpoint:
1) The project has around 1000 sounds that are played across 16 channels on an audioscience card that is split into 2 devices in windows (so I’m using two fmod.systems). Volume levels for each channel are done on the fly.
2) Some of the sounds are available for the entire game.
3) There are 5 levels in which a portion of the sounds are created, then no longer needed in other levels. These levels are loaded randomly and multiple times.
Here’s the way I’ve currently implemented it:
1) System and System1 are set up on executable load according to the best practices.
2) Since the sounds are created on the fly and can randomly be there or not when a scene is open or not, here’s an example for some of the sounds playing on certain channels (these are also added to a dictionary to avoid continuous duplication of the sounds):
[code:ano5i0un]FMOD.Sound FMODSound = null;
FMOD.Channel FMODchannel = null;
result = system.createSound(SoundFile, (FMOD.MODE.HARDWARE), ref FMODSound); //SoundFile is a string containing the file path
result = system.playSound(FMOD.CHANNELINDEX.FREE, FMODSound, true, ref FMODchannel);
result = FMODchannel.setSpeakerMix(CurrentSpeakerMix, CurrentSpeakerMix, CurrentSpeakerMix, CurrentSpeakerMix, CurrentSpeakerMix, CurrentSpeakerMix, 0.0f, 0.0f); //play all but the last two
result = FMODchannel.setPaused(false);
3) And here’s how I’m attempting to free up the memory on every new level:
[code:ano5i0un]foreach(KeyValuePair<String,FMOD.Sound> SoundEntry in SoundEffectsLibrary)
FMOD.Sound tmpFMODSound = SoundEntry.Value;
tmpFMODSound.release(); //release the sound
tmpFMODSound=null; //set the sound to null
Debug.Log ("Couldn’t free sound because " + ex.Message);
//clear out the dictionary
Any help would be greatly appreciated!
Thanks in advance!
- palamangelus asked 6 years ago
- You must login to post comments