A WeakReference allows the garbage collector to reclaim an object while still allowing the program to access it if it hasn't been collected yet. This is useful for caches or mappings where you don't want the reference to prevent garbage collection of the object, thereby avoiding potential memory leaks.