Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Weak reference
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|In programming, a reference which does not protect its object from garbage collection}} In [[computer programming]], a '''weak reference''' is a [[reference (computer science)|reference]] that does 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#]], [[Lua (programming language)|Lua]], [[Java (programming language)|Java]], [[Lisp (programming language)|Lisp]], [[OCaml]], [[MATLAB]],<ref>[https://uk.mathworks.com/help/matlab/matlab_oop/weak-reference-handles.html]</ref> [[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>{{Cite web|url=https://www.php.net/manual/en/class.weakreference.php|title = PHP: WeakReference - Manual}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)