Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Problem with RAM

Discussion in '2D' started by svyathor, Jun 14, 2020.

  1. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    Hello I'm making a 2D game for Android. My game weighs 60 MB but when you go from the menu to the level, the app crashes. In the phone settings, I found that the app used 12 GB of RAM when switching from one scene to another. There is no such problem on the computer. What might be the problem?
     
  2. brigas

    brigas

    Joined:
    Oct 4, 2014
    Posts:
    522
    sounds like you have a memory leak, you should use a memory profiler to try to identify it
     
    svyathor likes this.
  3. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    Thanks.
    Unfortunately, the memory profiler crashes with the app. the scene I'm uploading isn't too demanding. I don't know what the problem is yet.
     
  4. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Definitely sounds like a memory leak.
     
    svyathor likes this.
  5. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    Thank you for your answer. is this a problem in the app? And is it possible to solve it?
     
  6. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Delegates are usually the main culprit behind memory leaks. Do you maybe have any delegates/event subscriptions being created in a loop or within any of the
    Update
    functions in any of your scripts?
     
    svyathor likes this.
  7. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    Thanks for your reply. Can it depend on the animation in the loop? I will definitely analyze all the scripts. And I will answer.
     
  8. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    It can if the animation is calling a function that creates a delegate.
     
    svyathor likes this.
  9. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,197
    Hi,
    Which version of Unity and which memory Profiler (i.e. Memory Module in the Profiler or Memory Profiler package) are you using?
     
    svyathor likes this.
  10. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    I use Unity 2019.3.14f1 and I use memory profiler from googleplay
     
  11. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,197
    If you update to 2019.3.15f1 or 2019.4.x (version 2019.3.12f1 - 2019.3.14f1 are affected by this bug, I chimed in because I thought that that might be the issue you're hitting) you could try to investigate that with the Memory Profiler Package.
     
    svyathor likes this.
  12. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    Can a large sprite size be a problem.
     
  13. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,197
    Please define large? Actually, no. I can't really imagine that being the case. I'd suspect the fault to be somewhere in your code.
    I can't really trouble shoot this through the forums for you, since I don't have any clue what is going on in your project. The Profiler and the Memory Profiler might be able to help getting some crucial background info, without which the best thing I can do here can be equated with pointing a very narrow lazer pointer blindfolded into the night sky and hoping to hit a star in our galaxy. Please try to use these tools, try to get as far as you can using the documentation I just linked to, just to narrow it down as far as possible and then I can maybe give you some further hints based on what you found.
     
    svyathor likes this.
  14. svyathor

    svyathor

    Joined:
    Aug 18, 2019
    Posts:
    32
    Thank you all, I solved the problem. The problem was that the scene had an animation consisting of 140 frames in full HD.
     
    MartinTilo likes this.