Mistake
Objects with a short lifespan cannot be garbage-collected because an
object with a long lifespan refers to them, resulting in a memory
leak.
Watch for It When
Using objects with mismatched lifespans (usually collections), using
objects that use collections internally, such as listeners, and using
caches.
Solution
Put adds and removes close to each other in the code. If you have a
cache, define an expiration policy. Where possible, use weak
references to allow garbage collection.