- Home /
Asset bundle memory leak and exception
Hi!
I have some problems related to unloading asset bundles. The problem is that unity leaks memory and throws the exception
Deleting persistent object without writing it first: customassetbundle-91b1e3789f272034fb2e5b6c381c4bce
Stacktrace:
UnityEngine.AssetBundle:Unload(Boolean)
Resource:Unload() (at Assets\Resource.cs:192)
ResourceManager:DiscardResource(String) (at Assets\ResourceManager.cs:103)
AssetBundleMemoryLeakTest:Update() (at Assets\AssetBundleMemoryLeakTest.cs:73)
[C:/BuildAgent/work/842f9557127e852/Runtime/BaseClasses/BaseObject.cpp line 324]
(Filename: Assets/Resource.cs Line: 192)
when unloading an asset bundle under certain conditions.
Steps causing the exception and resulting memory leak:
load an asset bundle containing a prefab which has a diffuse material and no texture set
After loading the asset bundle, set a dynamic texture to the diffuse material (manipulate the asset bundle)
Create one ore more instances of the modified asset bundle game object
When done, destroy all instances, the dynamic texture and the asset bundle
This will not free all used resouces, which causes a serious problem when loading and unloading a lot of asset bundles
Additional to the leaked memory the given exception is thrown, each time AssetBundle.Unload(true/false) is called
I have to modify the game object before instancing it. So assigning the e.g. textures to the created instances is no option.
I am using unity 3.4.1.
I have created a little test project which reproduces the problem. It is attached to the error report:
http://fogbugz.unity3d.com/default.asp?420383_nh181n8ge0fq5u6o
Thanks in advance!
Answer by jonas-echterhoff · Sep 23, 2011 at 12:45 PM
This sounds like a bug to me. Please report it using our bug reporting tool.
Thanks for your reply Jonas. A have already filed a bug report. Its the one linked in the inital post. The bug contains a simple test scene reproducing the memory leak. I would really appreciate it if you could take a look at the demo project.
Thanks.
Your answer
Follow this Question
Related Questions
Marching cubes Memory Leak 1 Answer
Unloading asset bundles doesn't clear memory on iOS 1 Answer
Memory leak using bundles. 1 Answer
Mesh memory leak 3 Answers
assetBundle.mainAsset exception 0 Answers