ItemRepository bucket memory leak

David Nolden david.nolden.kdevelop at art-master.de
Fri Jun 12 18:00:33 UTC 2009


Am Freitag 12 Juni 2009 18:19:24 schrieb Peter Oberndorfer:
> Running valgrind on some duchain tests it seems Buckets are leaked in
> ItemRepository::close()
>
> Attached patch should fix this.
>
> A question if i understood it correctly:
> m_fastBuckets is just for being able to access buckets in m_buckets fast
> without any function call.
Yes exactly.

Actually I think this patch should better not be applied, even if it is 
correct. The buckets contain the actual data that is used by many different 
items, for example macros or identifiers. ItemRepository::close() is only 
called during application shutdow, and the buckets do not contain any 
meaningful destructors, thus it has no negative side-effects to let them leak.

Data that is stored within such buckets is for example permanently held by 
KDevelop::Identifier and KDevelop::QualifiedIdentifier. Deleting the buckets 
would mean that from that point on, any use of an Identifier or 
QualifiedIdentifier could lead to a crash during shutdown, depending on the 
shutdown sequence.

Since the shutdown sequence seems to be nearly random, and we've had quite a 
few such shutdown sequence problems already, it's probably better to just let 
this leak intentionally, and just add a comment describing that problem 
instead of the qDeleteAll.

Greetings, David





More information about the KDevelop-devel mailing list