Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by pax_thor · Mar 28, 2014 at 10:26 PM · iosassetbundle

AssetBundles on iOS: Memory always increases, causing crash

We have our asset bundles stored on an Amazon S3 bucket. When the game starts, it determines which bundles it needs to download new versions of, using WWW.LoadFromCacheOrDownload.

The problem we're running into is the memory iOS reports it has allocated for our app keeps increasing, however the memory Unity reports it's using (through the profiler) always stays the same. We have enough bundles that by the time it has finished downloading everything we need, it has invariably received a memory warning from iOS, and we are shutdown due to memory pressure shortly after.

Common solutions we have in place already: Unloading the assetbundle after the WWW is finished, using assetBundle.unload(), calling Resources.UnloadUnusedAssets(), and calling Dispose() on the WWW. None of it is solving the problem.

Code follows:

     private IEnumerator DownloadBundle(DownloadQueueEntry entry, DownloadFinishedCallback callback)
     {
         while (!entry.finished)
         {
             // grab bundle off S3
             string url = string.Format(BUNDLE_URL_FORMAT, entry.directory, entry.assetName);
             
             WWW www = WWW.LoadFromCacheOrDownload(url, entry.version);
             
             yield return www;
             
             if (string.IsNullOrEmpty(www.error))
             {
                 Debug.Log("[BundleDownloader] Download Completed " + entry.assetName);
                 
                 entry.finished = true;
                 entry.downloading = false;
                 www.assetBundle.Unload (true);
                 Resources.UnloadUnusedAssets ();
             }
             else
             {
                 // usually timed out resolving host, just try again for now
                 Debug.LogError("[BundleDownloader] Download failed: " + url + " Error: " + www.error);
             }
             
             www.Dispose();
             www = null;
         }
         if(callback != null)
         {
             callback ();
         }
     }

A screenshot showing the increasing memory usage is at the link below. Memory usage proceeds like that until it has chewed up around 150MB. This is all in an scene that only has a GameObject for init scripts in it (no art or anything).

https://www.dropbox.com/s/3b6skexz6xhug5g/Screenshot%202014-03-28%2014.54.26.png

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image BenouKat · Nov 20, 2015 at 02:39 PM 0
Share

Hi,

The post is old but I'm actually facing the exact same situation. How did you solve it ?

avatar image rebelincontrol BenouKat · Mar 22, 2016 at 09:15 AM 0
Share

Same here - did you find a solution?

avatar image pax_thor rebelincontrol · Jul 01, 2016 at 02:30 PM 0
Share

Hey guys,

Sorry for the long silence. We were never able to solve it ourselves, but the problem did go away in later versions of Unity, so I figure there was a bug somewhere.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Asset Bundles with In-App Payment in Unity Mobile 1 Answer

Animator in assetbundle from iphone app not play 1 Answer

Using AssetBundles as IAP Crashing 0 Answers

Does Apple allow you to download assetbundles with scriptableobjects, from an external server? 0 Answers

Accessing external asset bundles from local iOS files. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges