[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Special purpose malloc() in KDE?
From:       Rik Hemsley <rik () kde ! org>
Date:       2001-03-26 0:42:38
[Download RAW message or body]

I compiled malloc.c as a shared library (dlmalloc.so) and
preloaded it. I loaded my app (squelch, an Ogg Vorbis audio
player) and waited for it to have finished doing its
initialisation phase.

Some results...

> squelch
VmSize:    21328 kB
VmLck:         0 kB
VmRSS:      7844 kB
VmData:    11352 kB
VmStk:        80 kB
VmExe:       332 kB
VmLib:      8872 kB
 
> squelch (second attempt)
VmSize:    21364 kB
VmLck:         0 kB
VmRSS:      7812 kB
VmData:    11388 kB
VmStk:        80 kB
VmExe:       332 kB
VmLib:      8872 kB
 
> LD_PRELOAD=dlmalloc.so squelch
VmSize:    20556 kB
VmLck:         0 kB
VmRSS:      7840 kB
VmData:    10560 kB
VmStk:        80 kB
VmExe:       332 kB
VmLib:      8888 kB
 
> LD_PRELOAD=dlmalloc.so squelch (second attempt) 
VmSize:    20556 kB
VmLck:         0 kB
VmRSS:      7796 kB
VmData:    10560 kB
VmStk:        80 kB
VmExe:       332 kB
VmLib:      8888 kB

I don't know if this is the right way to measure, but the results look
like I would expect :)

According to /proc/<pid>/status, I have 'saved' about 792kB, or
7.5% of VmData.

These statistics are not really conclusive yet... Perhaps my app doesn't
cause much fragmentation at startup. I don't _think_ it should cause
much during normal operation. For example, at one point in the code I
have to maintain a large buffer of PCM data.  I store this as a ring
buffer and avoid deleting/re-allocating it at any point after startup.

I probably do some [de]allocation when dealing with 'track' objects in
the playlist. I can't be sure how much goes on though, without using a
proper tool to measure [de]allocations, because all these objects are
full of implicit shared data and are passed around by value.

I performed some 'complex' operations (creating a huge list of 'track'
items in the playlist and destroying it again, 5 times.)

> squelch
VmSize:    21400 kB
VmLck:         0 kB
VmRSS:      8148 kB
VmData:    11424 kB
VmStk:        80 kB
VmExe:       332 kB
VmLib:      8872 kB

> LD_PRELOAD=dlmalloc.so squelch
VmSize:    20564 kB
VmLck:         0 kB
VmRSS:      7836 kB
VmData:    10568 kB
VmStk:        80 kB
VmExe:       332 kB
VmLib:      8888 kB

Here it looks like I have 'saved' 856kB, or 8% of VmData.

I think this really needs a good test (by someone who knows what they're
doing) on an app that does a lot of work on the heap, e.g. konqy.
Initial results look promising to me, but my methods could be unsound
(the horror ! the horror ! ;)

Rik

 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic