ryoakg
5/1/2016 - 3:47 AM

GCed-but-agent-still-live.clj

(defn hello-forever [a]
  (println "hello!")
  (Thread/sleep 1500)
  (recur 1))

(let [a (agent nil)]
  #_(send a hello-forever)
  (send-off a hello-forever)) ; no reference to the agnet

(System/gc) ; force GC

;; but still prints `hello!'.