System for using both weak and soft references generically. Weak references don't count for anything in the gc while soft references will keep their object alive as long as there is no gc pressure.
System for using both weak and soft references generically. Weak references don't count for anything in the gc while soft references will keep their object alive as long as there is no gc pressure.
(gc-reference item dispose-fn)
Create a weak reference to the item. Return the actual reference. You can get the item (assuming it hasn't been cleaned up) using .get method on the reference. Note that dispose-fn must not reference item in any way else the item won't get cleaned up.
IF track-reference is true, then the reference itself is added to the reference set. This keeps the reference itself from being gc'd. This is not necessary if you know the reference will outlive the tracked object (or if you don't care).
Create a weak reference to the item. Return the actual reference. You can get the item (assuming it hasn't been cleaned up) using .get method on the reference. Note that dispose-fn must *not* reference item in any way else the item won't get cleaned up. IF track-reference is *true*, then the reference itself is added to the reference set. This keeps the reference itself from being gc'd. This is not necessary if you know the reference will outlive the tracked object (or if you don't care).
(soft-reference item dispose-fn)
Create a soft reference to the item. Return the actual reference. You can get the item (assuming it hasn't been cleaned up) using .get method on the reference. Note that dispose-fn must not reference item in any way else the item won't get cleaned up.
If track-reference is true, then the reference itself is added to the reference set. This keeps the reference itself from being gc'd. This is not necessary if you know the reference will outlive the tracked object (or if you don't care).
Create a soft reference to the item. Return the actual reference. You can get the item (assuming it hasn't been cleaned up) using .get method on the reference. Note that dispose-fn must *not* reference item in any way else the item won't get cleaned up. If track-reference is *true*, then the reference itself is added to the reference set. This keeps the reference itself from being gc'd. This is not necessary if you know the reference will outlive the tracked object (or if you don't care).
(track item dispose-fn)
Track an item via both the gc system and the stack based system. Dispose will be first-one-wins. Dispose-fn must not referent item else the circular dependency will stop the dispose-fn from being called.
Track an item via both the gc system *and* the stack based system. Dispose will be first-one-wins. Dispose-fn must not referent item else the circular dependency will stop the dispose-fn from being called.
(track-gc-only item dispose-fn)
Track this item using weak references. Note that the dispose-fn must absolutely not reference the item else nothing will ever get released.
Track this item using weak references. Note that the dispose-fn must absolutely *not* reference the item else nothing will ever get released.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close