Weak Reference

Noun · Development

Definitions

  1. A reference to an object that does not prevent it from being garbage collected. Used to build caches, observer patterns, and break reference cycles without causing memory leaks.

    In plain English: A reference that says 'I'd like to use this object if it still exists, but don't keep it alive just for me.'

    Example: "Use a WeakRef for the cache so entries get collected when nothing else holds them."

Related Terms