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
2
Question by Jeffom · Jun 13, 2012 at 07:22 PM · crashmemoryleak

Memory Issues in Unity for Android and IOS

I'm working on a project that uses lots of GUIs and WWW. The issues with memory involving the www were all resolved thanks to the author of this question.

But we're still having issues with memory allocation. We double checked our scenes and scripts and found nothing unusual, and when run in the editor shows no memory problem.

But when we play the game on mobile devices the memory usage keep growing and growing until the app crashes.We tought it could be memory leaks from the textures and/or objects. But i discarded that after some texts in empty scenes with our scripts.

We found that by forcing the System.GC.Collect() in some momments of our code would release some of the allocated memory. But that would only buy us some time until the application crashes again.

We're using unity 3.5.0f5 and our App consumes about 80MB of real memory in the profiler of the xCode, and I'd like to know if someone with similar issues solved his/her problem, and how :/

Comment
Add comment · Show 11
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 whydoidoit · Jun 14, 2012 at 04:08 PM 1
Share

Have you tried using Resources.UnloadUnusedAssets?

avatar image Jeffom · Jun 14, 2012 at 04:47 PM 0
Share

yes, we call it every now and then, usually after ending a match or unloading lots of textures.

avatar image whydoidoit · Jun 14, 2012 at 04:55 PM 0
Share

So another idea - are you using any kind of dictionary or list that stores references or uses keys that are GameObjects, assets, Components etc?

avatar image Jeffom · Jun 14, 2012 at 05:04 PM 0
Share

actually yes we are, but mostly through plugins.

avatar image whydoidoit · Jun 14, 2012 at 05:07 PM 1
Share

Ok so you can end up eating your memory that way if you aren't careful - it's the easiest way in the world to have a hard to find memory leak.

If it's in plug ins then make sure that only sensible values are kept - if you are doing it yourself then consider something like this which doesn't hold a strong reference.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Jeffom · Jun 25, 2012 at 07:10 PM

Found the answer in this post

http://answers.unity3d.com/questions/7836/preloading-caching-prefabs-unity-iphone.html

seems like

 GameObject newObject = someReference;
 GameObject.Destroy( new Object );
 newObject = new GameObject();

flags the unity to release the memory alocated by the previous object, and my problem was not doing this with my texture objects (1024x1024) problem solved after adding this to my codes.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Help when playing in Editor , Big memory Leak/problem 0 Answers

iOS Memory Handling Crash on Startup 0 Answers

Laggy gameplay and occasional crashes 1 Answer

Editor crash after editing in a better computer 0 Answers

Crash from texture memory? 2 Answers


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