Profiling an empty single view app - memory usage keeps going up!

JoeProJoePro CAUniversity ✭✭✭
edited July 2017 in Profiler

The app started out using 21MB and just sat there for a little over 9 minutes, slowly increasing to 57.7MB.
How on earth is this possible?

Seems to happen on both device and simulator.


  • JoeProJoePro CAUniversity ✭✭✭

    @RodrigoMoya Any idea what could be causing this weird behaviour?

  • RodrigoMoyaRodrigoMoya ESXamarin Team Xamurai

    Well, it might be weird or not, depending on what the app does. The Mono GC doesn't free memory immediately, it does so when it needs memory, so since the memory amounts you're talking about here are insignificant (an iOS device/sim can perfectly deal with an app allocating 57MB of memory), seems the GC is not firing, because it doesn't need to.

    If you take a snapshot though, you should see memory getting decreased, as the GC does its work when taking snapshots.

    On the other hand, if the app is doing nothing, it shouldn't really increase its memory usage, unless it's doing something in the background. Best way to see it would be to take several snapshots (you can set it to take one automatically every 30 seconds, for instance) and then compare and see what new objects are added on each snapshot.

  • JoeProJoePro CAUniversity ✭✭✭

    I totally agree 57mb is not a big deal, I was more concerned with the fact it kept slowly increasing while just sitting there.
    The app does not contain one single line of user code. It's built directly from the single view app template in Visual Studio for Mac.

    I did another test run, this time taking snapshots every 2 minutes. Memory keeps going up, but allocations don't change.

    Is this just a display bug with the profiler, or is memory usage really going up? This is on 1.5.4-19

  • volomaslovvolomaslov Member

    Hello guys,

    I'm facing with same memory growing with just single view app, is it related to some internal allocations and cycles?
    Memory is cleaned up with some time (6-10 mins), so feels like GC is doing his job well, but infinity memory increasing feels strange, is it expected behaviour?

  • RodrigoMoyaRodrigoMoya ESXamarin Team Xamurai

    I think it depends on the memory usage of the app, if it is not using much memory, the GC won't fire, as it just does not need more memory and hence to garbage collect.

Sign In or Register to comment.