About bug 44697: konqeror leaks memory when javascript enabled

Koos Vriezen koos.vriezen at xs4all.nl
Thu Oct 10 22:21:31 BST 2002


Hi,

This should be far less dramatic in CVS HEAD now that 'timesFilled' is
removed from kjs/collector.cpp. However there is still no way to actually
decrease max. memory before the collector start collecting garbage.
I made a patch for it:

RCS file: /home/kde/kdelibs/kjs/collector.cpp,v
retrieving revision 1.35
diff -u -3 -p -r1.35 collector.cpp
--- collector.cpp       2002/09/19 16:55:35     1.35
+++ collector.cpp       2002/10/10 21:10:28
@@ -86,6 +86,9 @@ void* Collector::allocate(size_t s)
       // Even after collection we are still using more than half of the limit,
       // so increase the limit
       softLimit = (unsigned long) (softLimit * 1.4);
+    } else if (softLimit/(1+filled) > 5 && softLimit > KJS_MEM_INCREMENT) {
+      // more than 80% is freed, lets decrease the limit
+      softLimit = (unsigned long) (softLimit / 1.4);
     }
   }


Objections?

Regards,

Koos





More information about the kfm-devel mailing list