Unity 4.6 - Crash on Build - Failed to allocate memory

Hello all.

So I’ve been having build problems for a while. Usually it crashes just at the very end of the build, but I was always able to fix it by closing Unity and starting it up again. Now it just crashes every time I build.

First of all, I want to make it clear that I am trying to build for Windows/Mac/Linux. In researching this particular issue, I noticed that a lot of people had this issue when their project folder was too large or there was a particular asset that was just too big for Unity 32bit to write. Well, I haven’t added anything recently to my project that exceeds more than 100mb and the project file itself is 7gb.

Here is the error I get:

It is consistant in that it always hangs up on AudioManager.cpp. So it might have something to do with the audio. I am using WWISE Unity integration, so I’m not sure if that is a problem.

I was unable to file a crash report as it just freezes when I hit Send. (it freezes while “Compressing”) With that in mind, I just thought I’d post here while also sending something to support@unity.com. Hopefully someone here has had this issue and was able to fix it.

Thanks in advance

Chuck

Well, the support guys will probably tell you to submit a bug report. It’s unlikely that they’ll have any magic ideas. I suspect the crash report isn’t freezing, it’s just spending time compressing and transferring the project file. If you have an ftp account, upload your project to that, then include the link to it in your bug report and untick the upload project option.

If your project is 7GB, and you’re trying to create a build with an application that has around 3GB of available memory then it’s likely that it’ll run out of memory.

Graham, thank you for taking the time to answer my question. I’ve begun uploading my project to the FTP server and will be filing a bug report using that method.

As for your other point. Am I correct in assuming that Unity cannot build projects that are that size? I find that a bit odd considering the size of most current PC games. I know people have talked about asset bundles when faced with this problem before, but I’ve also heard from just about everyone I talked to who has used Unity that asset bundles are a mess and that I should stay away from them.

Is there perhaps another way I should be structuring my project so that I can actually create a build? Or perhaps there is some way for me to narrow down what might be causing this particular crash?

Well, Unity makes builds using threads, so the intention is that a large game can be built even if the final content uses more memory than a 32-bit app can work with.

Asset bundles are a mess? Not sure who you’ve talked to. It might be worth creating a per scene asset bundle for textures (which are often large). That should reduce the size of the build. Then for each scene, load the asset bundle and pull out the textures it contains. This isn’t easy, but would be what I’d do if I couldn’t make a build.

I have a lot of friends at different major companies in California, some of which use Unity. I was asked a few weeks before Christmas if I had ever used asset bundles before, when I said no, my friend said " Be thankful for that." Mess might not be the right word. It’s more likely a pain than a mess.

After doing more research on the matter, I’ve seen that asset bundles are usually used for online games rather than what I’m doing here.

I would like to point out that I was able to solve my particular issue by starting a new project and copying the assets bit by it over to the empty project from what I guess was the broken one. I was able to build all the levels as desired. I made sure to watch the memory usage of Unity this time and it never went above 2.4g. (When building on the old project, it would hit up to 3.2g at times.)

Anyway, I guess the best way this issue can be fixed is to have a 64-bit editor. You know, like most of the other game development tools have. Just seems like a really big missed opportunity.

My snarky comment aside. Feel free to mark this resolved in case someone else has an issue with it. I’d be happy to elaborate on my fix if that is the case.

Something like Unity 5.0 you mean?

Heh, yea I just figured that out myself. Apologies for the misunderstanding, and thanks for letting me know! Although, I’m sure the folks running Unity 4 might also like a 64-bit editor as well, you know, just because it’s 2015 and not 2004.