- Home /
Max Bundle Size
Are there limits (practical or documented) that exist for building asset bundles. We have a situation where last year we were running out of memory (heap, presumably not physical) during building. We have since taken much of the assets and stored them in a set of asset bundles that are built from the command line with headless Unity. We are now running into memory problem again and I am wondering if we are just abusing the build pipeline or is there a bug. Again, these machines have 16GB of RAM so this is not physical memory.
What is different about the bundle that started causing the problem is that there are a lot of character prefabs that have a fair amount of FBXs that were added. The nature of the character models have not changed they are just more complex. This is actually one of our smaller bundles size wise, but the others do not contain the characters. Here is the asset bundle build preamble....
Textures 6.5 mb 1.3% Meshes 402.7 mb 78.5% Animations 20.2 mb 3.9% Sounds 10.4 mb 2.0% Shaders 28.6 kb 0.0% Other Assets 71.4 mb 13.9% Levels 0.0 kb 0.0% Scripts 0.6 kb 0.0% Included DLLs 0.0 kb 0.0% File headers 1.8 mb 0.3% Complete size 513.0 mb 100.0%
... ... ...
Unity(22120,0xa0742540) malloc: mmap(size=537911296) failed (error code=12) error: can't allocate region *** set a breakpoint in malloc_error_break to debug Out of memory! UnityEditor.BuildPipeline:BuildAssetBundleInternal(Object, Object[], String[], String, BuildAssetBundleOptions, BuildTarget) UnityEditor.BuildPipeline:BuildAssetBundleExplicitAssetNames(Object[], String[], String, BuildAssetBundleOptions, BuildTarget) AssetBundleExportTool:Export(BundleModel) (at Assets/Editor/AssetBundleExportTool.cs:289) AssetBundleExportTool:ExportBundles(IEnumerable`1) (at Assets/Editor/AssetBundleExportTool.cs:116) AssetBundleExportTool:Update() (at Assets/Editor/AssetBundleExportTool.cs:249) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) System.Reflection.MethodBase:Invoke(Object, Object[]) UnityEditor.HostView:Invoke(String, Object) UnityEditor.HostView:Invoke(String) UnityEditor.HostView:SendUpdate() UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
[/Applications/buildAgent/work/71ca6fec1b41cc30/Projects/../Editor/Src/Application.cpp line 2139] (Filename: Assets/Editor/AssetBundleExportTool.cs Line: 289)
Edit: 3/22 Absolutely no word from Unity either way on this bug. I am almost certain that it has something to do with the animations. We have had more failures on other bundles now and in ever case can be traced back to a commit that made the bundle include a character with many prefabs. 20 MB does not sound like a ton of animations though.
Answer by Daniel-Brauer · Oct 17, 2011 at 11:21 PM
I just ran into this error myself, and was able to work around it by creating a series of smaller bundles instead of one large one. From the Editor.log, it looks like Unity is running out of memory during or just after LZMA compression. As with your situation, I don't think physical memory should be an issue here, but at least the issue can be worked around.
It's quite possible that you've discovered this yourself, but you'll want to push dependencies with each successive bundle to avoid duplication of assets.
Answer by kirpigiller · Jul 04, 2013 at 06:50 AM
Don't know is the problem actual now, but... Making of a bundle with such size - is absolutely out of unity bundles ideology. You will change one mesh - and what? download 500Mb pack again?
Anyway, your problem could be solved like this: start a fresh unity (i.e. run unity in batchmode with a "build something" script) for each building step. I build my project in 6 steps.
Your 16Gb of phisical memory is enough. That ~1.7Gb(32bit) or ~2.8Gb(64 bit) that Unity has on Windows - is not enough. Vote for 64bit Unity if you wish