This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (2)
- # beginners (17)
- # calva (3)
- # cljdoc (4)
- # cljsrn (7)
- # clojure (99)
- # clojure-europe (6)
- # clojurescript (18)
- # clojureverse-ops (2)
- # cryogen (1)
- # cursive (11)
- # datomic (2)
- # duct (6)
- # figwheel-main (2)
- # fulcro (3)
- # graalvm (2)
- # honeysql (1)
- # introduce-yourself (5)
- # juxt (2)
- # leiningen (4)
- # meander (11)
- # membrane (14)
- # practicalli (1)
- # re-frame (4)
- # reagent (5)
- # rum (1)
- # shadow-cljs (17)
- # spacemacs (13)
- # tools-deps (6)
Hi all, I'd like to try my hand at some Cljs so that I can get a feel of making UIs in a data driven approach which will hopefully help me carry those concepts to other langs like JS/TS where data driven approaches aren't mainstream yet. Does anyone have any good recommendations?
i've made this app that eats up memory after few days of running and i am not sure how to go about fixing it.
I've heard about memory leaks but never had the pleasure to debug them. Could this be it?
How do i analyze memory usage over time?
I've got some basic monitoring done and i see that heap oscillates between 300-600mb but ram usage climbs till 77% and then randomly spikes to 80-90% and then i have to restart the app which brings memory usage back to 40% and then it climbs.
Does anyone have any pointers about what should i do or how to approach this?
I've used https://www.reddit.com/r/Clojure/comments/g68uvy/creating_a_jvm_heap_dump_from_the_repl/
and memory analyzer to look at heap dump but i don't see any useful information there...
clojure.lang.var = 15% of bytes used this could be anything because i am using
mount to keep some state on the backend.
Is looking at heap wrong thing to do ?
take a look at https://visualvm.github.io/ or https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm#JFRUH170 for tools to help you with this kind of stuff
also stuff like https://docs.oracle.com/javase/7/docs/technotes/tools/share/jhat.html might be useful
@U45SLGVHV do any of your components' states have caches, atoms, or similar object retention?
@U45SLGVHV A few things: 1. How much total heap are you running? From my experience, ~2GB is the minimum when I was running a Clojure JVM container on AWS ECS. Otherwise, the container might get killed. 2. When you say “randomly spikes … and I have to restart the app” what do you mean precisely? Is the JVM “frozen” or it “exits”? 3. On a scale of 1-10, how positive are you that you have a memory leak? As per point 1., you might simply need more heap. The JVM GCs can act in unexpected ways and generally require a good chunk of memory with Clojure, in my experience.
I am making the guesses above because you mentioned “300-600mb” which is pretty tiny, as far as JVM Clojure is concerned.
@U050ECB92 yeah there are about 5 atoms that hold state of different parts of the app. That state is used in different parts of the app. As i mentioned i am using
mount state management lib
1. Total memory is at 2gigs at the moment. Usually used is about 1.5gigs but heap max is 800mb and usage is what i shared above.
2. The app starts to become slow and sluggish visually (by using the UI) looks like something is wrong, it takes long time to ssh into the instance. After restart everything is good
3. well i am not sure, i've noticed that memory usage steadily climbs and i am afraid GC isn't clearing something that it should be. So i just want to make sure that it isn't a leak
I decided to allocate more heap and bump up the instance,
It seems that memory peaks and lingers around some % of memory used.
This will definitely show if memory leak is preset, because if it is i expect memory to rise more and more.
One question is there a way to find out which clojure namespace/function that's related specifically for the code base uses most memory or possibly has memory leak?
I've used VirtualVM but most memory consuming objects where
java.lang.Object i didn't find anything about the problem with this 😞
@U45SLGVHV I don’t think there’s a straightforward way to locate a memory leak as related to a function/namespace.
that's a shame. I am seeing steady climb in last 24h but it's so gradual like it came up 10% from 28% to 38% memory used. heap used seems to be grabage collected so i am seeing up and down a lot but this upward trend could be problematic 😞 i expect it to peak at 40% and stay there cause that would signify same amount of memory used just different instance
Hi, yes and no we don't have errors anymore (obvious because there is more ram) but there is still memory leak somewhere that causes memory usage to go up 3% over last 3days. This is something i can live with because of i every 2 weeks or so. I have suspects what could cause that gradual growth but it's not worth investigating at the moment