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 Bazeragi · Aug 27, 2013 at 09:55 AM · iosmemorymemory managementasset bundles

Asset bundles using double memory!

Hi, we are making quite a large IOS game and have recently run into memory problems. The main issue is we were using resources to load everything but this means that the memory isn't released after the object is destroyed! we moved onto using asset bundles to load some of the main objects so we can control the memory and release it after the object is destroyed. This works but there is a massive drawback, the Asset bundle uses double the memory!! we have tried to release the bundle and not destroy the objects after instantiation but this has the same issues and resource loading. Has anyone had the same issue? is there a way to use asset bundles but not double the memory??

Thanks

Comment
Add comment · Show 6
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 dorpeleg · Aug 27, 2013 at 10:40 AM 0
Share

please post an example of you asset loading code.

I think I know what the problem is, but I need to see the code to make sure.

avatar image Bazeragi · Aug 27, 2013 at 11:16 AM 0
Share

Ah nice one! this is the function we use for loading

 private IEnumerator ReloadBundle( string _bundleName ) {
     isLoading = true;
     
     string file = "file://" + bundleFolder + "/" + _bundleName +".unity3d";
     
     WWW www = WWW.LoadFromCacheOrDownload (file, 1);

     yield return www;
     
     AssetBundle bundle = www.assetBundle;

     if (bundle != null) {
         
         string bundleFile = Path.GetFileName (file);
         string bundleExtension = Path.GetExtension(bundleFile);
         string bundleName = bundleFile.Substring(0, bundleFile.Length - bundleExtension.Length);
         
         if (!bundles.Contains$$anonymous$$ey (_bundleName)) {
             bundles.Add (_bundleName, bundle);    
         }
         else {
             bundles[bundleName] = bundle;
         }
         //Debug.Log("Size before: " + sizeof(www.bytes) );
         www.Dispose();
         //Debug.Log("Size: " + sizeof(www.bytes) );
         www = null;


     }
 
     isLoading = false;
 }

Let me know if there is any other info you need

thanks

avatar image dorpeleg · Aug 27, 2013 at 12:15 PM 0
Share

hmmmm... I thought you where missing the www.Dispose, but I see you have it.

Can you explain what do you mean by "double the memory"?

How to do know it's double and not the normal size?

avatar image Bazeragi · Aug 27, 2013 at 01:12 PM 0
Share

Ah i see, well we have a memory profiler and can see the actual memory stats in game and the memory is double when using asset bundles. The memory gets released properly when we unload the bundle with the true flag set but it isnt much help if the memory is double to sart with.

avatar image hanshardmeier · Jan 03, 2014 at 08:42 AM 0
Share

Did you find something? I am facing the same problem. I will check the thing with www.dispose thou. A 40$$anonymous$$B Bundle covers 150 $$anonymous$$B RA$$anonymous$$ (explorer with $$anonymous$$AT)... Dont know why...

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by milox777 · Jun 14, 2014 at 10:23 AM

Try to use: bundle.unload(false) at the end of 'ReloadBundle' method.

Comment
Add comment · Share
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

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

18 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

Related Questions

Memory Allocation Continues to Grow? iOS. 4.6.3 0 Answers

AudioManager memory usage on iOS when using Asset Bundles 3 Answers

I have this out of memory issue when running my webgl game in iOS. 0 Answers

Is there a way to release Mono memory on iOS? 0 Answers

Unity Sprite Memory Usage Is Huge 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