[Interest] Question to members of the Qt team: why does an empty project consumes so much memory on iOS?

Thiago Macieira thiago.macieira at intel.com
Tue Apr 21 19:30:24 CEST 2015


On Tuesday 21 April 2015 18:16:57 Nuno Santos wrote:
> Thiago,
> 
> Sorry for not having replied to you. I missed your email.
> 
> "Is that 16 MB of heap? Or are you including sharable & discardable code
> pages?”
> 
> Sorry but I really don’t know what to answer here.
> 
>  I’m just launching a new and empty Qt Quick project on Xcode and looking to
> the memory usage.

The point is that you're not measuring memory properly.

Let me take the example of Qt Creator

F   UID    PID   PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND
0  1000  51459   2285  20   0 3085928 127168 -    Sl+  pts/0      9:12 
bin/qtcreator

How much memory is it consuming? Would you answer 2.94 GB? Maybe 124 MB?

The answer is yes and no for both numbers. It depends on what you're 
measuring. And there are more numbers:

$ ~/src/owntools/rssanalyse/rssanalyse.pl `pidof qtcreator`
Total mapped memory:     3085932 kB
    of which is padding: 1933552 kB
   of which swapped out: 669832 kB
  of which likely stack: 32908 kB mapped, 108 kB resident (64 kB main, 44 kB 
aux threads)
  of which are resident: 130152 kB, 123534 kB proportionally shared
        total anonymous: 98168 kB (75.4%)
                 Shared: 10200 kB total (7.8% of RSS)
              Breakdown: 3476 kB clean (34.1%), 6724 kB dirty (65.9%)
                         3100 kB code (30.4%), 376 kB RO data (3.7%), 6724 kB 
RW data (65.9%)
                         0 kB heap (0.0%), 0 kB stack (0.0%), 0 kB other 
(0.0%)
                Private: 119952 kB total (92.2% of RSS)
              Breakdown: 32600 kB clean (27.2%), 87352 kB dirty (72.8%)
                         21768 kB code (18.1%), 1052 kB RO data (0.9%), 360 kB 
RW data (0.3%)
                         96652 kB heap (80.6%), 108 kB stack (0.1%), 12 kB 
other (0.0%)

The number in VSZ is usually not quoted because, as you can see, 62% of it is 
*padding* between sections of RAM.

124 MB is how much it really uses in RAM, but 10 of those is clean & shared 
and another 32 MB is clean & sharable (but not shared, because no other 
process loads the Qt Creator libraries). All clean pages can be discarded on 
memory pressure and reloaded from disk.

Then there's 654 MB that is swapped out.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list