<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I tried using jemalloc, but the generated output (attachment)
looks useless to me.</p>
<p><a class="moz-txt-link-freetext" href="https://gist.github.com/thomasdarimont/79b3cef01e5786210309">https://gist.github.com/thomasdarimont/79b3cef01e5786210309</a></p>
<div class="moz-cite-prefix">On 07/08/2024 20.57, Thiago Milczarek
Sayão wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAAP_wunU7qgGa27UQagzAo3V=+1LrmtuXhjiiTqwS_xh=KaMrQ@mail.gmail.com">
<div dir="ltr">Hi,
<div><br>
</div>
<div>
<div>There are some tips in this post (I've never tried them).
GTK related environment variables generally work.<br>
</div>
<div><a
href="https://stackoverflow.com/questions/16659781/memory-leaks-in-gtk-hello-world-program"
moz-do-not-send="true" class="moz-txt-link-freetext">https://stackoverflow.com/questions/16659781/memory-leaks-in-gtk-hello-world-program</a><br>
</div>
<div><br>
</div>
<div>valgrind and java:</div>
<div><a
href="https://stackoverflow.com/questions/9216815/valgrind-and-java"
moz-do-not-send="true" class="moz-txt-link-freetext">https://stackoverflow.com/questions/9216815/valgrind-and-java</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>-- Thiago</div>
<div><br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Em qua., 7 de ago. de 2024 às
13:20, <<a href="mailto:quizynox@gmail.com"
moz-do-not-send="true" class="moz-txt-link-freetext">quizynox@gmail.com</a>>
escreveu:<br>
</div>
<blockquote class="gmail_quote">Hello,<br>
<br>
Through developing JavaFX apps on Linux (X11, KDE) I always
see the <br>
pattern when process (native?) memory doesn't get released
back to the OS.<br>
<br>
1. when app starts, the Java process consumes a relatively
small amount <br>
of RAM (I track this via top or DE system monitor), usually
around 120Mb.<br>
2. if you do any manipulation with Stage (like resize it
several times, <br>
or open the context menu several times) the memory process
usage goes up <br>
to 130Mb.<br>
3. then comes GC, which collects some _heap_ memory and
returns it back <br>
to the OS depending on JVM settings, let say -5Mb<br>
4. I repeat step 2, and JVM process process usage goes up
again, +10Mb<br>
5. again GC collects some _heap_ memory and uncommits it back
to OS, -5Mb<br>
<br>
I have profiled the application with JDK 21 / JavaFX 21 and
the <br>
following settings:<br>
-Xms32m<br>
-Xmx64m<br>
-XX:+UseZGC<br>
-XX:+ZUncommit<br>
-XX:ZUncommitDelay=30<br>
<br>
Heap is not a problem, it's always ~20-30MB.<br>
Metaspace is not a problem either, it's always around 2-4MB.<br>
<br>
It looks like native (stack, thread?) memory leaks, so never
returned to <br>
the OS. I've never seen JavaFX app process memory usage return
(not even <br>
close) to the same value it started with. RAM usage increases
gradually <br>
and can be 1.5, 2, 3 times the initial value. Yet the heap
usage never <br>
rises above the -Xms value.<br>
<br>
I run the same application (it's basically an empty stage) on
Windows <br>
and see no such behavior. Process memory usage returns back to
initial <br>
value almost immediately. Also, on Windows the JVM is freeing
memory <br>
even without using ZGC.<br>
<br>
How should I profile this? Any hints?<br>
<br>
</blockquote>
</div>
</blockquote>
</body>
</html>