On 6/10/11 9:07 AM, Denys Vlasenko wrote:

> At the very least, I would like to see its memory consumption
> to go down substantially.

Let's try to turn this into something constructive.  I'll start with 
David Malcolm's rather nifty, if unpolished, 'heap' plugin for gdb:

https://fedorahosted.org/gdb-heap/wiki

Simply running the 'heap' command tells me that systemd is using 21M of 
malloc'd data, and that about 11M of it is entirely within allocations 
that are all 2064 bytes apiece.  Everything else, in comparison, is 
pretty insignificant:

        Domain         Kind        Detail    Count  Allocated size
-------------  -----------  ------------  -------  --------------
uncategorized                 2064 bytes    5,370      11,083,680
uncategorized                   32 bytes   70,788       2,265,216
uncategorized                 1072 bytes    1,503       1,611,216
uncategorized                   96 bytes   11,420       1,096,320
             C  string data                 12,964         630,672
uncategorized                  528 bytes    1,067         563,376
uncategorized               528384 bytes        1         528,384
uncategorized                  272 bytes    1,894         515,168
uncategorized                   64 bytes    6,342         405,888
uncategorized                   48 bytes    8,446         405,408
/* a bunch of stuff in between omitted */
uncategorized                 2272 bytes        1           2,272
uncategorized                 1568 bytes        1           1,568
uncategorized                  800 bytes        1             800
                                    TOTAL  127,119      21,934,576

That's a pretty unusual size, 2064 bytes.  That works out to 2048 + 16, 
though, which are much more natural-sounding numbers.  A quick 
experiment with a demo program (allocate a 32-byte struct and then call 
pause()) shows that the 16 is actually the overhead from malloc itself:

        Domain  Kind    Detail  Count  Allocated size
-------------  ----  --------  -----  --------------
uncategorized        48 bytes      1              48
                         TOTAL      1              48

So now the problem is simply to find a 2048-sized allocation within 
systemd, or one of its libraries.  Anyone interested in a homework problem?

- ajax
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Reply via email to