Hey everyone.
I am working with Away3D 4 for about 2 months now and I seem to have an issue with my memory management.
I am at this point not sure if this is simply a problem of me not understanding some of the basic things I should be doing or if it is something else.
I am loading a model via Loader3D and add it to the root:
m_Loader3D = new Loader3D();
m_Loader3D.addEventListener(LoaderEvent.RESOURCE_COMPLETE, OnResourceComplete);
m_Loader3D.addEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
m_Loader3D.loadData(new model());
m_SceneRoot.addChild(m_Loader3D);
Once OnResourceComplete is called I add textures and remove the event listener from m_Loader3D.
This works all fine. The model is being rendered correctly.
Then, at some point, I want to delete it. This is how I do it.
m_SceneRoot.removeChild(m_Loader3D);
m_Loader3D = null;
If my understanding is correct, the garbage collector should now pick up the loose ends and delete it from memory?
However, if I check the memory consumption (firefox-plugin-container) then nothing is ever freed up. If I repeat above steps then every time I load the model again more memory is used up while setting the loader3D to null will never free up anything.
I have set Loader3D(false) as well to make sure the AssetLibrary is not used but to no avail.
Am I missing something incredibly basic? I thought the GC will free up anything that isn’t referenced anymore?
Edit:
If I repeat above steps continuously memory will continue to grow until it will crash.