Skip to content

Memory leaks in Generics.Collections.THashSet

I accidentally discovered that calling any THashSet method of the four:

  • UnionWith()
  • IntersectWith()
  • ExceptWith()
  • SymmetricExceptWith()

leads to memory leaks (see test.pas).

The attached patch seems to fix the situation.

The same seems to be observed in TSortedHashSet, so a new patch has been added.

test.pashashset.patch gencoll.patch

OMG, in TSortedSet everything seems to be the same.

gencoll2.patch

Edited by avk959
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information