Regarding Konqueror JavaScript memory leak (bug #44697)

Per Sigmond Per.Sigmond at kitrus.com
Thu Nov 21 17:36:18 GMT 2002


Thanks. We've hand-applied the relevant parts of the patch to 3.0.5 (which is 
all except the applyUserAgent stuff). After testing it for a few hours today 
against some JavaScript-centric sites, it fixes the reference leak problem 
and also seems to fix most of our memory leak problems!

Question: We find that after browsing heavily on pages with a lot of pictures 
and JavaScript for some time, the memory usage increases with approx. 4-5 
MBytes. Then when going to a simple web page the memory usage stays the same 
for some time (is this how is should be?). Then when hiding the window (or 
just being idle for some time) the memory usage drops to the initial level. 
Can anyone explain this, or should we have seen other behaviour from the 
browser?

Regards,
Per.

On Thursday 21 November 2002 02:11, Dirk Mueller wrote:
> On Die, 19 Nov 2002, David Faure wrote:
> > In theory all the refcounting due to the KJS wrappers for DOM nodes
> > have been cleared already at that point (by m_jscript->clear() above
> > that) so I don't believe this is due to JS. Could be wrong there, though.
> > Only debugging will tell :)
>
> the scriptinterpreter keeps references to all dom nodes it ever touched, so
> this is leaking heavily and a lot, since dom nodes don't delete their
> children until they're deleted themself.
>
> below is the patch. it mixes another fix I have in the sources for a few
> months now but never commited (lazy ass I know). it fixes a dangling
> pointer read upon shutdown in the useragent stuff, as during shutdown
> clear() is called but the useragent stuff is already deleted at that point.
> I move the applying of the useragent to initScript() instead. this should
> work I think (never tested it actually), but I've found out that initScript
> is always called upon a new page-view, so it should be safe.
>
> Please review. I'd really have this in KDE 3.1 because of the severity of
> the leak. but this can also be quite intrusive. luckily we have valgrind
> now to find possible problems quicker :)

-- 
Senior IT consultant, Kitrus as
Per Sigmond, Gjert Sorensensvei 5, 4879 Grimstad, Norway
+47-90721913 (voice/sms), +47-37298001 (fax)
Per.Sigmond at kitrus.com, http://www.kitrus.com/~per/
Red Hat Certified Engineer & Examiner (RHCE,RHCX)
---
Kitrus: http://www.kitrus.com
RHCE: http://www.redhat.com/rhce/rhce806199697700507.html





More information about the kfm-devel mailing list