This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-21
Channels
- # adventofcode (20)
- # babashka (118)
- # beginners (170)
- # calva (1)
- # clojure (102)
- # clojure-europe (1)
- # clojure-nl (13)
- # clojure-uk (5)
- # clojuredesign-podcast (19)
- # code-reviews (10)
- # core-async (9)
- # cursive (7)
- # datomic (8)
- # fulcro (3)
- # malli (5)
- # mount (1)
- # off-topic (19)
- # overtone (1)
- # reagent (2)
- # reitit (2)
- # spacemacs (2)
- # sql (4)
- # tools-deps (5)
God I hate javafx with all my soul. what am I doing wrong? even the lightest pure text gui eats up ALL (15 GB) the memory until the whole computer grinds to a halt and requires hard reset. I have tried the following options too in leiningen project.clj :
:jvm-opts ["-XX:+UseG1GC" "-Xms2g" "-Xmx2g"]
and its not just my applications. it's the same for nightcode, scenebuilder, anything javafx.
what gives? should I just switch to electron? is swing any better? what other choices do I have for building a gui?If the JVM process is actually running with those command line options, I am surprised if it is consuming more than 2GBytes of memory. What measurement are you taking that leads you to conclude it is going over that?
I don't use javafx but I am curious about this, since I know that DirectBuffers are often used for graphics work and these are allocated outside of the Java heap. I found a couple of related issues but they may not apply to your case. https://bugs.openjdk.java.net/browse/JDK-8192056 https://stackoverflow.com/questions/26247746/bizarre-javafx8-outofmemoryerror-fadetransition/26250775
Probably worth asking in a Javafx forum.
thanks for the hints. I guess I have to mess around with jvm-opts and monitor the memory consumption of different fx apps more closely.
At a minimum, it shouldn't max out your ram, you should be abke to limit Java's memory usage and it should throw an outofmemory error if it runs out
Hum, for night code I don't know. It probably has a launcher script, that calls java, and that must be setting those (or not setting them)
Cognitect REBL uses Java FX, and while I haven't used it long, I know plenty of people who do, and haven't heard complaints about memory usage.
Oh, night code seems to use javapackager to create a bundle. I don't know if its possible to then change the JVM options
On which OS are. you running Nightcode?
hmmm, i'll just play with it for awhile to see what happens. left to their own configurations the javafx apps eat all the memory until the system freezes.
Someone said online some JVMs now default to using 75% of your ram. I think especially server ones, which is likely what the ones that come with Linux distros are going to be targetting
With Xmx being 75% of your total ram. It doesn't leave a lot of room. So if the other apps use more than 25% of your Ram your OS would start to trash and Linux isn't able to recover from trashing
does this look normal to you?!
size_t MaxMetaspaceSize = 18446744073709547520 {product} {default}
uintx MaxHeapFreeRatio = 70 {manageable} {default} uintx MaxMetaspaceFreeRatio = 70 {product} {default}
Well, so it seems if you start a java app, which does not set Xmx, you'd default to having a Xmx of 5.25GB
I just killed nightcode (which was launched with
nightcode -XX:+UseG1GC -Xms1g -Xmx1g
). right after death, about 9G memory was released.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 8395 veixq5 20 0 102,6g 449016 116936 S 3,2 2,2 0:29.37 java
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
31905 ------ 20 0 6.048g 0.439g 0.094g S 4.983 11.78 1:02.39 Nightcode
thanks for your help. I guess I might try running these apps in another OS through virtualbox.
Doesn't really make it clear, but since to indicate it is neither the amount of physical or swap memory used, but just the amount of address space allocated. Dunno what that means
I believe RES memory matters much more than VIRT when it comes to thrashing
This one has better explanations: https://serverfault.com/questions/138427/what-does-virtual-memory-size-in-top-mean
I see crazy large numbers for VIRT all of the time, and have never found a reason to pay attention to them.
in any case, tweaking the jvm heap size and GC seems to have been effective. I'll leave nightcode open for a few hours.
I believe Nightcode itself runs using its own bundled JVM, but the REPL it launches uses your system's JVM
Sigh. Are there any tricks for using lein uberjar
when you (:require [aleph.http])
? It just seems to hang for me and I suspect it's because netty's running on a thread and preventing completion.
Hmm. aleph gives some netty log messages (when used in combination with taoensso/timbre and slf4j adapters) but doesn't prevent uberjar. yada gives a reflection warning but doesn't prevent uberjar.Must be something else!
aleph/start-http usually starts in the background AFAIK. I remember jetty adapter had this parameter called join?
which by default blocked the current thread, but I never experienced that with aleph. Do you provide any additional options when starting the server?
Thanks Vasilii actually I worked out aleph is fine. The simple act of requiring cljfx was the obstruction!
How do I get this working with lein?
:compile-java {:jvm-opts ["-Xlint:unchecked"]
:java-source-paths ["src-java"]}
lein with-profiles +compile-java do clean, javac
Unrecognized option: -Xlint:unchecked
What is the best way to parse a string into sensible peaces? For example this one: Dec 21 17:38:43 hostname script.sh[483]: 19-12-21 17:38:43 hostname INFO [namespace.function:216] - logstring
. How to get from this string tockens like date, loglevel, namespace/function/line , logstring, etc...
in general regular expressions, that is not clojure related, here are some examples how to use them in clojure: https://purelyfunctional.tv/mini-guide/regexes-in-clojure/
If under your control, I'd try hard to favor data over text https://clubhouse.io/blog/structured-logging/
You might also be able to use Spec https://juxt.pro/blog/posts/parsing-with-clojure-spec.html