When running the functional tests several times, a gradual slow down can be seen and the memory usage goes up.
Note that the functional test creates randomized realms and configurations, which makes it easier to trigger this memory leak.
When debugging the test runs I could see the followings:
- SMSEventListener#nodeChanges and #subNodeChanges tends to grow in size
- Upon GC runs nodeChanges cleans up, but subNodeChanges does not
- subNodeChanges are meant to be cleaned up in CachedSubEntries#finalize call (sigh)
- subNodeChanges however are also cached in CachedSubEntries#smsSubEntries map that does not appear to be cleared at any point in time..
At the very least we should make sure that when configuration is removed, the CachedSubEntries maps is cleared up at the same time - this would then make sure that the #finalize is called which then cleans up the final remnants of the CachedSubEntries instance. We should change CachedSubEntries to not override #finalize at all.