Weak reference: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
m Reverted edits by 87.61.119.229 (talk) (HG) (3.4.10)
Line 1:
In [[computer programming]], a '''weak reference''' is a [[reference (computer science)|reference]], whichthat doesn`tdoes not protect the referenced [[object (computer science)|object]] from collection by a [[garbage collection (computer science)|garbage collector]], unlike a strong reference. An object referenced ''only'' by weak references – meaning "every chain of references that reaches the object includes at least one weak reference as a link" – is considered ''[[weakly reachable]],'' and can be treated as [[unreachable memory|unreachable]] and so may be collected at any time. Some garbage-collected languages feature or support various levels of weak references, such as [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]], [[Lisp (programming language)|Lisp]], [[OCaml]], [[Perl]], [[Python (programming language)|Python]]<ref>[https://docs.python.org/3/library/weakref.html 8.8. weakref — Weak references], The Python Standard Library</ref> and [[PHP]] since the version 7.4<ref>https://www.php.net/manual/en/class.weakreference.php</ref>.
 
==Uses==