in some cases i have use www to download many texture2d objects,
after these texture object are not useful or referenced anymore, should i
manually call Object.Destory() to release the memory?
thx!
in some cases i have use www to download many texture2d objects,
after these texture object are not useful or referenced anymore, should i
manually call Object.Destory() to release the memory?
thx!
No i don’t think so, it should not affect performance (Pay attention to “I think”)
thx sturestone
since the existence of the Object.FindObjectOfType function, the unity engine may keeps all the references of the created Objects, so i am wondering if i need to tell the engine to erase the references
You don’t have to worry about memory management; Unity takes care of that. The garbage collector will clean up unused stuff when necessary.
–Eric
unless you’re using WWW.Texture. If you assign some variable = WWW.Texture that does not get garbage collected, even after the object you assigned the texture to is destroyed. I had to write my own garbage collection routine to clean up after that.
Sounds strange… I thought mono/unity will take care of the reference count properly.
So did I, but that is one of the two major memory related issues that we discovered with our project early on. The other one was that each call to WWW.Texture creates a new texture instance, so if you want to apply the same texture to multiple objects without using more memory you need to manually create an instance of the texture, then assign that instance to the objects.
Fixing those two things let us reduce our memory consumption by about tenfold (about 90% of our texture assets are dynamically loaded)