Profiler shows steadily increasing iOS app memory usage while Instruments shows flat memory usage

While profiling my iOS app with the Mac Xamarin Profiler v1.6.3 (and 1.6.4.30), I am seeing steadily increasing memory usage when the app is idle, however when profiling the same build of the app under Instruments, the memory usage is flat and stable.

How can I explain these results?

The memory usage reported in Instruments should include whatever memory is being used by the C# runtime, right? If the app were leaking memory the way that the Xamarin Profiler seems to indicate, I would expect to see the same memory growth reported with Instruments.

Here is a screenshot of my memory usage graph when simply launching the app and letting it idle on the initial screen for about 15 minutes. The bottom window is the same build profiled with Instruments in the same way.

https://us.v-cdn.net/5019960/uploads/editor/ko/ru59ttyxhb68.png

My current hypothesis is that the Xamarin Profiler itself is causing the memory leak. Building with profiler support adds code to the app to facilitate communication with the Profiler, correct? Is it possible this code is hanging on to memory and self reporting it as being used in the app?

Does anyone from the Xamarin Profiler team monitor these forums?

Answers

  • OlehKosiakov.1962OlehKosiakov.1962 USMember

    Hi!

    My opinion is that Xamarin profiler shows memory allocations , and, Instruments show memory usage itself.

    Here is quote from Xamarin.Profiler docs:
    _ ... At the top of the profiler is the allocations chart, which displays the amount of memory allocated at regular intervals during the profiling. Currently the allocations graph is the total number of allocations and NOT the size of the heap at that point in time. In a sense, it will never go down, it will only ever increase. This includes objects allocated on the stack. _

    But it may mean that something is cycled and uses memory, but Garbage Collector successfully handles that. I would suggest to check Background threads etc.

Sign In or Register to comment.