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

List:       kde-devel
Subject:    Re: Tracking allocated memory (was: Tracking memory leaks -- advice
From:       Harri Porten <porten () tu-harburg ! de>
Date:       1999-06-23 15:48:44
[Download RAW message or body]

Pietro Iglio wrote:
> 
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> 
> On 6/23/99, 4:28:04 PM, Harri Porten <porten@tu-harburg.de> wrote
> regarding Re: Tracking allocated memory (was: Tracking memory leaks --
> advice  needed):
> 
> > Pietro Iglio wrote:
> > >
> > > ... then kpanel enters in the event-loop with 433k allocated. As you
> > > can see, KApp
> > > and the registry stuff are allocating about 250k, i.e. more than 50%
> > > of the memory
> > > allocated for kpanel on startup! I suspect that QApplication is
> > > largely responsible
> > > for that, isn't it?
> 
> > I got:
> 
> >  KApplication: ~70kB
> >  QApplication: ~98kB
> 
> > kpanel was the first app from KDE_1_1_BRANCH I instrumented
> > withfprintf()'s for alloc_current. Needless to say that it leaks
> memory
> > constantly. The most trivial observation: on each
> > kPanel::slotUpdateClock() the amount of allocated memory increases by
> > 100-150 bytes _without_ any user interaction.

After applying the following patch

--- tools.C     1999/04/11 15:11:21     1.60.4.3
+++ tools.C     1999/06/23 15:37:52
@@ -647,6 +647,7 @@
 
   strftime(dateline,256,i18n("\n%b %d"),loctime);
 
+  QToolTip::remove(label_date);
   QToolTip::add(label_date,
QString(dayline)+QString(timeline)+QString(dateline));
 
   if (label_date->fontMetrics().lineSpacing() * 3 <=
label_date->height())

I'm down to 73 bytes leakage per click. Anybody know how to get rid of
them ? QToolTip::add() makes a deep copy but shouldn't remove() take
care of that ?

> You are right, I have discovered and removed some memory leaks from
> kpanel (some fixes
> are already in the CVS, others are on the way).

> If other guys are interested, I can release the patch and add a short
> section to the Harri's paper.

Please do so. dmalloc offers so many features that it deserves an own
paper/HOWTO though. We should then combine all materials we have on
debugging leaks on one site.

Harri.

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

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