calling www to get audio.clip multiple times causes memory problems

I download a wav sound then load it with www. Then if I download another the memory is still being used by the first one (this is on the iphone – I’m watching the memory profile of the app)

How do I clear the memory or variables (delete? destroy) to free up the memory each time I download a new sound? What are the general rules for deleting things in variables if they are going to be used multiple times?


Here’s the code that I call multiple times which causes the memory accumulation.

function getAudio1(){
 var mp3WWW = new WWW(path_to_sound_file);
 display="loading clip";
    yield mp3WWW;
var myclip=mp3WWW.GetAudioClip(false);
audio.ignoreListenerVolume =true; 


HI, this post is a little old but, yes there’s a way, you have to call the function Resources.UnloadUnusedAssets(); each time you change the path to load in the www object. :slight_smile: