Author Topic: memoryproblem on android  (Read 5017 times)

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
memoryproblem on android
« on: August 30, 2013, 05:06:32 AM »
I have a game with two scenes, menu and game. When jumping from the scene menu to game on Android the atlas texture used in menu isn’t removed from memory even though it's not referenced in game. However, this problem does not appear when doing the same thing in the editor. When using the memory profiler on the Android I can see that the texture has one reference the atlas material but that material itself does not have any references.

This is a big problem for me beacuse when the memory gets full I get a big spike due to garbage collection but the texture is still not being removed.

Only thing I can think of is that the material is referenced in a static variable and maybe that’s why it doesn’t show any references in the memory profiler?

Any ideas on how to solve or work around this?

sisso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 46
    • View Profile
Re: memoryproblem on android
« Reply #1 on: August 30, 2013, 07:54:36 AM »
In the editor, if you select the atlas texture and "Find References In Scene", it's show anything?

Remember that prefabs references counts as dependencies. For exemplo: If you have a object that point to GamePrefab, that point to StorePrefab and it points to SellPopup that has a Widget pointing to atlas. The atlas will be load in memory.

Debug in unity why something is loaded is really a pain in the ass :P

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
Re: memoryproblem on android
« Reply #2 on: August 30, 2013, 08:03:11 AM »
Man I tried everything from UnloadUnusedAssets to finding any kind of reference throught static variables etc. But I found another thread that explained that you have to disable the ngui root to clean up hidden geometry, references etc. So I just disable it before loading the next level and voila, it works!

 :)

sisso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 46
    • View Profile
Re: memoryproblem on android
« Reply #3 on: August 30, 2013, 10:11:35 AM »
Interesting, it really could be helpful. I didn't found this thread. Could you please post the link?

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile