Hello Guest

Author Topic: "Fatal Error! Could not allocate memory" during building  (Read 7609 times)

Finnegan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
"Fatal Error! Could not allocate memory" during building
« on: July 16, 2014, 05:53:50 pm »
Project size is about 2.7GB (but only 200mb compiled to iOS .ipa file). All worked fine until recent addition of one more 4096x4096 texture for Retina.

Any workarounds? I don't know how to manage it besides removing HD assets from build or waiting for 64bit Unity.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: "Fatal Error! Could not allocate memory" during building
« Reply #1 on: July 16, 2014, 09:08:31 pm »
The problem with this is that Unity doesn't seem to purge memory between building assets in Resources. All the platform collections go into resources, so at some point 32 bit unity is going to run out of memory building textures in resources. This isn't tk2d specific, its purely down to that specific issue above.

As for workarounds... I can think of a couple
1. Dont use platform collections, but rather turn on mipmaps, and QualitySettings.masterTextureLimit
2. Modify the tk2d code to allow loading from asset bundles. This will involve a fair bit of work.

Finnegan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: "Fatal Error! Could not allocate memory" during building
« Reply #2 on: July 17, 2014, 09:43:28 am »
Ouch.

Could it get better if we split the largest 4096 textures into multiple atlases?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: "Fatal Error! Could not allocate memory" during building
« Reply #3 on: July 18, 2014, 02:44:38 pm »
Don't think so, I think it'll end up using the same amount of memory... This is a fundemental issue with how unity builds stuff in resources, it builds everything in one go. Might be worth asking unity support for a workaround, I dont know if different resources folders build at different times, etc.

pan_henryk

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: "Fatal Error! Could not allocate memory" during building
« Reply #4 on: July 22, 2014, 01:52:21 pm »
In our case compressing some textures works as workaround. Uncompressed build triggers this error, but after compressing some assets (texture atlases) it works again