Fork me on GitHub

Hi all, I’ve been debugging a memory leak in my application and have traced it back to agent executor threads still referring to the state I’m maintaining in agents. I noticed that clojure.core/send-via uses clojure.core/binding-conveyer-fn which sets the thread local bindings but never pops them. Can someone help me understand why bound-fn* isn’t used instead so that any thread locals on agent executor threads are cleared when the agent is done processing the message? Related:!topic/clojure-dev/3CXDe8_9G58/discussion


hmm, I see now that Toby hinted at the difficulty being that if the function that was sent to the agent throws an exception, the bindings are still expected to be set when caught by the error handler. if the sent function popped them then they wouldn’t be available anymore to the error handler