On Sat, Jan 24, 2009 at 06:13:48PM +0100, Hofmann Johannes wrote:
... the problem is that the destructor is not called atm. CssSimpleSelector is embedded in struct CombinatorAndSelector which in turn lives in a lout::misc::SimpleVector. So the memory is allocated with malloc and not properly handled with new/delete. This is nasty and has to be fixed somehow.
...especially as valgrind reports that this is one of Dillo's biggest leaks. I'm attaching a quick and dirty fix that defines a finalize() method on selectors. This still misses the case when the SimpleVector is resize()-ed, but that appears to be much more rare. The proper fix would be to replace the SimpleVector with a typed Vector with ownerOfObjects = true. Then finalize() could be turned into a proper destructor. That would mean CombinatorAndSelector inheriting Object. Regards, Jeremy Henty