Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Weak reference


In the News (Fri 25 Dec 09)

  
  Weak Pointer
A weak pointer (or a weak reference, as "reference" is a more abstract term for "pointer" that is not limited to a specific language) is a pointer which, in a system utilizing GarbageCollection, doesn't contribute to the liveness of the object it points to.
Weak pointers should have the property that if the object they are pointing to is recycled, any attempt to dereference the now-dead object through the weak pointer (or to assign it to a strong pointer) should fail with an exception.
In general, the reference gear guarantees that *all* weak references to a given object are cleared at the same time, That from the POV of all threads this is an atomic operation, that this happens only after the object has been finalised, and after all soft and hard references are cleared.
c2.com /cgi/wiki?WeakPointer   (820 words)

  
 PEP 205 -- Weak References
Presentation: Two ways that weak references are presented to the Python layer have been as explicit reference objects upon which some operation is required in order to retrieve a usable reference to the underlying object, and proxy objects which masquerade as the original objects as much as possible.
Reference objects are easy to work with when some additional layer of object managemenet is being added in Python; references can be checked for liveness explicitly, without having to invoke operations on the referents and catching some special exception raised when an invalid weak reference is used.
Weak references should be able to point to any Python object that may have substantial memory size (directly or indirectly), or hold references to external resources (database connections, open files, etc.).
www.python.org /dev/peps/pep-0205   (2564 words)

  
 Reference Objects and Garbage Collection
Weak reference objects connect to their referent not by a cable, but by a flexible rubber band, no number of which could support an object.
The only real difference between a soft reference and a weak reference is that the garbage collector uses algorithms to decide whether or not to reclaim a softly reachable object, but always reclaims a weakly reachable object.
Weak references work well in applications that need to, for example, associate extra data with an unchangeable object, such as a thread the application did not create.
java.sun.com /developer/technicalArticles/ALT/RefObj   (3382 words)

  
 Weak reference - Wikipedia, the free encyclopedia
Weak references are used to prevent circular references and to avoid keeping in memory referenced but unneeded objects.
Weak references may be used to solve the problem of circular references if the reference cycles are broken by replacing strong references with weak references.
Weak references are also used to minimize the number of unnecessary objects in memory by allowing the program to indicate which objects are not critical by only weakly referencing them.
en.wikipedia.org /wiki/Weak_reference   (381 words)

  
 weak references : Java Glossary
A weak reference is one that does not prevent the referenced object from being garbage collected.
A weak reference is a reference that does not keep the object it refers to alive.
Weak references are automatically deleted from a container as soon clients stop referencing them.
mindprod.com /jgloss/weak.html   (459 words)

  
 5.11 weakref -- Weak references
A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else.
A primary use for weak references is to implement caches or mappings holding large objects, where it's desired that a large object not be kept alive solely because it appears in a cache or mapping.
The references are not guaranteed to be ``live'' at the time they are used, so the result of calling the references needs to be checked before being used.
docs.python.org /lib/module-weakref.html   (1049 words)

  
 Weak - definition from Biology-Online.org
Lacking ability for an appropriate function or office; as, weak eyes; a weak stomach; a weak magistrate; a weak regiment, or army.
Lacking in elements of political strength; not wielding or having authority or energy; deficient in the resources that are essential to a ruler or nation; as, a weak monarch; a weak government or state.
Weak is often used in the formation of self-explaining compounds; as, weak-eyed, weak-handed, weak-hearted, weak-minded, weak-spirited, and the like.
www.biology-online.org /dictionary/Weak   (632 words)

  
 weakref   (Site not responding. Last check: 2007-10-08)
In the following, the term referent means the object which is referred to by a weak reference.
use weak references in their implementation, setting up callback functions on the weak references that notify the weak dictionaries when a key or value has been reclaimed by garbage collection.
One of the goals of the implementation is to allow any type to participate in the weak reference mechanism without incurring the overhead on those objects which do not benefit by weak referencing (such as numbers).
effbot.org /lib/weakref.html#getweakrefs   (1622 words)

  
 Java theory and practice: Plugging memory leaks with weak references
When a weak reference has been created with an associated reference queue and the referent becomes a candidate for GC, the reference object (not the referent) is enqueued on the reference queue after the reference is cleared.
Weak references and weak collections are powerful tools for heap management, allowing the application to use a more sophisticated notion of reachability, rather than the "all or nothing" reachability offered by ordinary (strong) references.
Reference objects and garbage collection: This paper from Sun, written shortly after Reference objects were added to the class library, describes how the garbage collector treats Reference objects.
www.ibm.com /developerworks/java/library/j-jtp11225   (2333 words)

  
 Why Garbage Collection?
Weak references enable you to create canonicalizing mappings, such as a hash table whose keys and values will be removed from the map if they become otherwise unreferenced by the program.
Weak references are similar to soft references, except that whereas the garbage collector is free to decide whether or not to clear soft references to softly reachable objects, it must clear weak references to weakly reachable objects as soon as it determines the objects are weakly reachable.
When the garbage collector determines that the referent of a phantom reference object is phantom reachable, it appends the phantom reference object to its associated reference queue.
www.artima.com /insidejvm/ed2/gc17.html   (806 words)

  
 Ethan Nicholas's Blog: Understanding Weak References
A weak reference, simply put, is a reference that isn't strong enough to force an object to remain in memory.
Weak references allow you to leverage the garbage collector's ability to determine reachability for you, so you don't have to do it yourself.
A soft reference is exactly like a weak reference, except that it is less eager to throw away the object to which it refers.
weblogs.java.net /blog/enicholas/archive/2006/05/understanding_w.html   (2204 words)

  
 Garbage Collection-Part 2: Automatic Memory Management in the Microsoft .NET Framework -- MSDN Magazine, December 2000
Long weak references allow you to resurrect an object after it has been finalized and the state of the object is unpredictable.
Obviously, the two weak reference tables are not considered part of an application's roots or the garbage collector would not be able to reclaim the objects pointed to by the tables.
If a pointer in the table refers to an object that is not part of the graph, then the pointer identifies an unreachable object and the slot in the short weak reference table is set to null.
msdn.microsoft.com /msdnmag/issues/1200/GCI2/default.aspx   (3977 words)

  
 The Memory Management Glossary: W
When only weak references to the object remain, the weak references can be deleted ("splatted" or "cleared") and the object reclaimed.
The weak tri-color invariant is the property of a reference graph that all white nodes pointed to by a fl node are also reachable from some gray node through a chain of white nodes.
determines that an object is weakly reachable, it clears all the weak references involved, and declares the object finalizable.
www.memorymanagement.org /glossary/w.html   (1332 words)

  
 WeakReference Class (System)   (Site not responding. Last check: 2007-10-08)
Represents a weak reference, which references an object while still allowing that object to be reclaimed by garbage collection.
A weak reference allows the garbage collector to collect an object while still allowing an application to access the object.
Instead of waiting for garbage collection to occur, a Timer is used to instigate garbage collection or to change the weak reference back to a strong reference to the object.
msdn2.microsoft.com /en-us/library/system.weakreference.aspx   (1596 words)

  
 jGuru: What is a weak reference and what are they used for?
When you use a weak reference you have to accept that the object referred to may have disappeared, which results in the reference being automatically set to null.
Weak references are not appropriate in all circumstances, but sometimes they can make code easier to write and understand.
Other specialist references are soft references (which inhibit collection until memory runs short), and phantom references (used for cleanup when objects are freed).
www.jguru.com /faq/view.jsp?EID=316912   (394 words)

  
 [No title]   (Site not responding. Last check: 2007-10-08)
The low-level machinery used by the weak dictionary implementations is exposed by the {@link weakref} module for the benefit of advanced uses.
If the referents are still alive, two references have the same equality relationship as their referents (regardless of the {@var callback}).
Testing that a weak reference object is still live should be done using the expression {@var ref}() is not None.
effbot.org /lib/weakref.txt   (1808 words)

  
 Weak - Wikipedia, the free encyclopedia
A weak reference is a reference that does not protect the referent object from collection by the garbage collector.
A weak symbol is a symbol definition in an object file or dynamic library that may be overridden by other symbol definitions.
The weak topology, the weak polar topology, the weak operator topology and weak-star topology of functional analysis.
en.wikipedia.org /wiki/Weak   (307 words)

  
 Dr. Dobb's | Java References | July 22, 2001
Weak references share with soft references the property that the garbage collector is welcome to release the contained object if no standard pointers to it exist.
To summarize, you use weak references instead of soft references to implement canonical objects when you don't need sophisticated memory management, but you do require that once removed from the table, the canonical object can never be retrieved.
Although weak references allow the symbols to be garbage collected, the weak reference objects themselves -- and the space they use in the table -- are reachable through standard pointers and will not be reclaimed.
www.ddj.com /184404000   (4293 words)

  
 Using Weak References   (Site not responding. Last check: 2007-10-08)
A weak reference is valid only during the indeterminate amount of time until the object is collected when no strong references exist.
Weak references are useful for objects that use a lot of memory, but can be recreated easily if they are reclaimed by garbage collection.
Avoid using weak references to small objects because the pointer itself may be as large or larger.
msdn2.microsoft.com /en-us/library/ms404247.aspx   (652 words)

  
 Reference (GNU Classpath 0.93 Documentation)
When a referred element gets collected the reference will be put on the queue, so that you will be notified.
Soft references will be cleared if the garbage collector is told to free some memory and there are no unreferenced or weakly referenced objects.
Weak references will be cleared as soon as the garbage collector determines that the refered object is only weakly reachable.
developer.classpath.org /doc/java/lang/ref/Reference.html   (512 words)

  
 weakfinex.nw
This note describes a preliminary implementation of weak references for R that subsumes the finalization mechanism added to R 1.2.
The design of the weak reference system is based on the one used in the Glasgow Haskell system.
Another approach would be to borrow from MzScheme's weak boxes the idea that an object ready for finalization be placed on some sort of queue and leave it to the programmer to run the finalizers in that queue periodically.
www.stat.uiowa.edu /~luke/R/references/weakfinex.html   (1372 words)

  
 Guidelines for using the Java 2 reference classes
The main feature of the reference classes is the ability to refer to an object that can still be reclaimed by the garbage collector.
In addition, the new reference classes all represent a "weaker" form of a reference than the typical strong reference.
In addition, weak references are useful for objects that would otherwise live for a long time and are also inexpensive to re-create.
www-106.ibm.com /developerworks/java/library/j-refs   (1924 words)

  
 XEmacs Lisp Reference Manual - Weak Lists   (Site not responding. Last check: 2007-10-08)
A weak list is a special sort of list whose members are not counted as references for the purpose of garbage collection.
Weak lists can be useful for keeping track of things such as unobtrusive lists of another function's buffers or markers.
Weak lists are used internally, for example, to manage the list holding the children of an extent -- an extent that is unused but has a parent will still be reclaimed, and will automatically be removed from its parent's list of children.
www.tau.ac.il /cc/pages/docs/xemacs/lispref_117.html   (298 words)

  
 WeakRef class Reference
Do not forget to release() the strong reference when you are done with it.
A weak reference points at the object, but does not control the lifetime of the object.
You will still need to release() the weak reference when you are done with it.
xplc.sourceforge.net /doc/doxygen/classWeakRef.html   (393 words)

  
 Manage memory effectively with Java reference objects
Reference objects are a special type of object for holding references to other objects in such a way that the garbage collector can still reclaim the referenced object's memory—this is also known as a weak reference.
Reference objects allow a program to keep references to objects that can be reclaimed if needed, as they do under low memory conditions.
Reference objects are represented by the classes SoftReference and WeakReference, found in the package java.lang.ref. The chief difference between these two classes is that the garbage collector uses different algorithms to decide when to reclaim the objects they refer to.
builder.com.com /5100-6386-1049545.html   (720 words)

  
 Weakly Reachable
An object is weakly reachable when the garbage collector finds no strong or soft references, but at least one path to the object with a weak reference.
If you make a weak reference to the thread with a reference queue, your program can be notified when the thread is no longer strongly reachable.
The code queries the reference queue for the weak reference, and upon finding the weak reference, sets the reference to the extra data to
sunsite.au.ac.th /JavaCorner/docs/tutorial/refobjs/about/weak.html   (426 words)

  
 nsIWeakReference
If, for instance, this owning reference is part of a cycle of owning references (e.g., if the referenced object also holds a owning reference back to you), then none of the objects in the cycle can be reclaimed without taking special measures.
By now you've probably noticed that this particular weak reference implementation doesn't give you exactly the interface you were hoping for.
It's clear, therefore, that the weak reference can't be aggregated to the target object.
www.mozilla.org /projects/xpcom/weak_references.html   (989 words)

  
 Bug ID: 4147808 Listener support classes should be able to use a weak reference
When an event source notices that a weak reference to a listener is cleared, the event source can automatically unregister the weak reference.
An object referred to by a FirmReference will not be GC'd, but if an object becomes reachable only by firm reference or weaker then the gc will signal to the ReferenceQueue that the reference should be dropped.
At the root of the problem is the fact that a listener class may do _anything_: it may refer to several objects within itself (although most refer to just one), so there is no easy way to automate the weak reference process.
bugs.sun.com /bugdatabase/view_bug.do?bug_id=4147808   (1340 words)

  
 Garbage Collection with Reference Objects
This section takes a look at how garbage collection is changed when two of the objects on the heap in the previous diagram are changed to weak reference objects.
So, weak reference objects let a program maintain a reference to an object without keeping the object from being collected.
The All About Reference Objects lesson explains the different types of reference objects and what is meant by strengths of reachability.
sunsite.au.ac.th /JavaCorner/docs/tutorial/refobjs/garbage/refobjs.html   (598 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.