mat icon indicating copy to clipboard operation
mat copied to clipboard

Detect cycles in WeakHashMaps

Open eclipsewebmaster opened this issue 9 months ago • 14 comments

| --- | --- | | Bugzilla Link | 296826 | | Status | ASSIGNED | | Importance | P3 enhancement | | Reported | Dec 03, 2009 11:22 EDT | | Modified | Feb 25, 2020 16:12 EDT | | Version | 1.1 | | Depends on | 297052 | | See also | Gerrit change https://git.eclipse.org/r/158295, Git commit e6465836, Gerrit change https://git.eclipse.org/r/158301, Git commit a78a213e, Gerrit change https://git.eclipse.org/r/158350, Git commit d8e9667e | | Reporter | Andrew Johnson |

Description

WeakHashMaps have entries with a key held by the reference of a WeakReference and a value. If the key is no longer accessible and is only weakly reachable then it can be cleared and then the hash map entry can be cleared.

A user error is to have a path from the value to the key. The key is then strongly referenced via the WeakReference value field and won't be cleared when otherwise inaccessible.

We should detect this problem.

eclipsewebmaster avatar May 08 '24 16:05 eclipsewebmaster