Regarding Konqueror JavaScript memory leak (bug #44697)

David Faure faure at kde.org
Tue Nov 19 12:24:36 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 19 November 2002 12:59, Per Sigmond wrote:
> Hi.
> 
> We work on a TV-customized version of konqueror (3.0.4) and ahev been
> experiencing serious problems because of memory leaks. Now we finally tracked 
> it down to JavaScript problems and found this bug report.  We would like to 
> help tracking this down in order to help ourselves :-)
> 
> Question: You say in the bug report that it's related to refcounting. Do you 
> have any more specific clues for us to follow while investigating this?

I don't, which is why I haven't been able to investigate the matter further.
I know how to debug memory problems within KJS itself, but I don't know how
to debug refcounting problems in KHTML. Can anyone on kfm-devel provide
some hints?

The debugoutput that I pasted in the comment comes from the following added line:
(pseudo patch for kdelibs/khtml/khtml_part.cpp)

@@ -909,8 +912,11 @@ void KHTMLPart::clear()

   // do not dereference the document before the jscript and view are cleared, as some destructors
   // might still try to access the document.
- -  if ( d->m_doc )
+  if ( d->m_doc ) {
+    kdDebug() << k_funcinfo << "doc=" << d->m_doc << " after clear and before deref: " << d->m_doc->refCount() << endl;
     d->m_doc->deref();
+  }
   d->m_doc = 0;

   delete d->m_decoder;

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 point is that this debug output line should show that refCount == 1, AFAIK.

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE92i2E72KcVAmwbhARAguPAJ9gX/iuzdRgzJjyUk/QDRr5V6FxNwCdHuhu
8L+VHQ3FTqw7JyaKrfPc/jA=
=Kw7K
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list