Problem Statement
I have two cars: A and B, both running Clojure.
B has some memory data structure.
A contains an A_P object, which is a reference / pointer to some B_O object in memory B.
Now, while A_P is NOT GC-ed from A, I don't want B_O GC-ed by B.
However, as soon as A_P was GC-ed from A (and nothing else in B_O and nothing else in B refers to B_O), then I want B_O to be elegant as GC-ed.
Language solution with destructors
In C ++, this is easy - I use destructors. When A_P receives GC-ed, A sends B a msg to reduce the number of external links to B_O, and when it is 0 and internal links to B_0 are also 0, then B_O receives GC-ed.
Solution in Java / Clojure?
Now I know that Java has no destructors. However, I am wondering if the Clojure method has this problem.
Thanks!
user1647794
source share