This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-26
Channels
- # announcements (3)
- # architecture (53)
- # babashka (6)
- # beginners (101)
- # bitcoin (3)
- # calva (4)
- # cider (3)
- # clara (7)
- # cljdoc (2)
- # cljsrn (14)
- # clojure (104)
- # clojure-europe (96)
- # clojure-germany (21)
- # clojure-nl (6)
- # clojure-serbia (3)
- # clojure-spain (1)
- # clojure-uk (13)
- # clojuredesign-podcast (4)
- # clojurescript (14)
- # cursive (5)
- # data-science (19)
- # datomic (16)
- # emacs (15)
- # fulcro (33)
- # graalvm (5)
- # honeysql (3)
- # instaparse (2)
- # jobs (3)
- # lsp (82)
- # malli (2)
- # off-topic (11)
- # pedestal (4)
- # polylith (62)
- # practicalli (4)
- # shadow-cljs (56)
- # tools-deps (53)
- # vim (17)
- # xtdb (53)
I think I have found a memory leak in clara when calling mk-session
. I have been trying to find a memory leak in one of our services. I eventually found that the leak was from mk-session. This service creates lots of rules dynamically so initially I assumed it was that. I saw the :cache
option in mk-session and thought that we were probably caching all those dynamically created rules, however turning off the cache did not help. I eventually created this minimal code to reproduce the leak. With cache false this leaks, with cache true it doesn't, but when adding in dynamically created rules the cache true also leaks, even after calling clear-session-cache!
(ns mem-leak
(:require [clara.rules :refer [mk-session defquery]]))
(defquery get-status [:?status] [?result <- :status [{status :status}] (= status ?status)])
(defquery get-all-status [] [?result <- :status])
(doseq [i (range 10000)]
(mk-session 'mem-leak
:cache false))
Good finding! Have you created an issue in the clara-rules github repo? https://github.com/cerner/clara-rules/issues
I haven't yet, I'm still busy digging into it, going to create the issue soon
Is this is the Clojure side or the clojurescript side? My gut says clojure, but i just wanted to make sure
At first blush, my mind goes to the nature of mk-session
. Its usage of eval
generates classes on the fly, and i have to wonder if those classes are unable to be freed for some reason….
I will have to find time to look into this
I didn't end up finding anything else useful, so I have just created the ticket https://github.com/cerner/clara-rules/issues/468