View Single Post
Old 03-23-2019, 12:30 PM   #34
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,930
Karma: 6361444
Join Date: Nov 2009
Device: many
FWIW, On Mac OS X 10.13.6 with Sigil-0.9.13, I ran 10 different searches by copying and pasting from your rtf file of searches with replace alls while running on the Mac OSX "leaks" memory leak tracker.

There were no leaks reported for the Regex Search and Replace code at all.

But that did not mean that the memory footprint didn't grow. It did, and correctly because of the use of a QCache in PCRECache.cpp to store up to 100 compiled regular expressions which it does for speed reasons because regular expressions searches are often repeated.

That said, this cache is automatically cleared with the least most recently used regular expressions being removed and freed when the cache needs more space.

This is why I tried to stress not looking at the memory usage (footprint) but whether or not the memory footprint actually caused slowdowns and crashes.

Again, memory use went up and then back down and finally stabilized just a bit higher from when I started the search and replaces (which is accounted for by the cache).

So, at least on Mac OS X, I can not recreate any true memory leaks when using regular expression search and replaces.

That said, I could easily force the cache to hold less than 100 compiled regular expressions to help reduce the maximum memory footprint if people think that might be useful. Since each compiled regular expression does not actually take up much memory at all, this would not shrink the total memory footprint by that much.
KevinH is offline   Reply With Quote