System of calling functions with side effects when an object goes out of scope. Scoping can be defined as gc-based scoping or stack-based scoping or a combination of the two of them in which case the behavior becomes 'release-no-later-than'.
For GC resources, users must not reference the tracked object in the dispose function else the circular dependency will keep the object in the gc's live set
System of calling functions with side effects when an object goes out of scope. Scoping can be defined as gc-based scoping or stack-based scoping or a combination of the two of them in which case the behavior becomes 'release-no-later-than'. For GC resources, users must not reference the tracked object in the dispose function else the circular dependency will keep the object in the gc's live set
(chain-resources new-resource old-resource)
Chain an older resource to a newer (derived) one such that the older resource cannot get cleaned up before the newer resource.
Chain an older resource to a newer (derived) one such that the older resource cannot get cleaned up before the newer resource.
(stack-resource-context & body)
Stack resource context. When this context unwinds, stack resource declared within will be released.
Stack resource context. When this context unwinds, stack resource declared within will be released.
(track item)
(track item {:keys [track-type dispose-fn]})
Track a resource. If the item inherents from PResource or is a clojure fn, or a Runnable object then it can be cleaned up by the stack system with no further dispose function. Objects tracked by the gc need to have a dispose fn that does not reference the tracked object.
Using stack-based resource tracking when there is no stack resource context open will generate a warning every time as it guarantees a memory leak.
Track types can be :gc, :stack, or [:gc :stack] with :gc being the default tracking type.
Track a resource. If the item inherents from PResource or is a clojure fn, or a Runnable object then it can be cleaned up by the stack system with no further dispose function. Objects tracked by the gc need to have a dispose fn that does *not* reference the tracked object. Using stack-based resource tracking when there is no stack resource context open will generate a warning every time as it guarantees a memory leak. Track types can be :gc, :stack, or [:gc :stack] with :gc being the default tracking type.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close