-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out Of Memory Exception #726
Comments
Tried your code on Windows 11, Java 17, and it works without consuming much memory. Only ~80 MB. What operating system do you use? |
Windows 11 Pro 22H2 22621.2134 I also tried on another PC with fresh install And I've also tried to build the project in a jar file but it results in the same error. Also, if I comment out the FlatLaf setup function it's also fine, it's just the combination of all three things that is the problem |
Can not reproduce here... What happens if you do not invoke You could use https://visualvm.github.io/ to check what objects require that much memory. When using indeterminate progressbar, it is repainted often. Since FlatLaf progressbar is not opaque (for rounded style), also the parent of the progressbar needs to repainted. Metal L&F has opaque square progressbar and does not repaint parent. You could make the progressbar opaque to avoid repainting image: progress.setOpaque( true ); |
New tests: If I replace
then it works fine even though the image comes out very jaggedy. If instead of my custom JPanel I do The more I try to understand it and the more I look at it and the more I get confused! EDIT: If I clone the image from the FlatSVGImage before passing it to my custom function then the resulting image comes out less sharp (might be the 1.25 scaling on my screen) but it doesn't cause the memory to overflow. see below:
|
Thanks for all the information. That brought me to the right direction 👍 There is a bug in FlatLaf/flatlaf-core/src/main/java9/com/formdev/flatlaf/util/MultiResolutionImageSupport.java Line 137 in a2859ce
(I've probably copied this from The cache key is of type Working on a fix... BTW initially was not able to reproduce the memory leak because Java 8 version of |
Perfect thank you for the explanation! I thought a bit more about it in the meanwhile and I did came to a similar ballpark conclusion, but this makes so much sense now ahahah Thank you very much for all the quick help! |
…on[],Function<Dimension,Image>)` (issue #726)
Fixed in FlatLaf 3.2.1 |
I feel like I'm going crazy....
Running the code below will result in an out of memory crash of the program! I have no idea why, even after a lot of tinkering around it... It always ends up filling around 1GB of RAM every 30 seconds or so.
I tried using the JSVG library without the FlatSVGIcon and it doesn't look like it's causing the problem.
Also, if I don't use the progressbar in indeterminate mode it's fine, and same if I have the indetermined progressbar but a normal JPanel instead of my custom one with the SVG background...
I so do not understand what is causing this
The Main Class:
The custom JPanel Class:
The SVG file:
I'm using JDK 17 with NetBeans IDE 18. The libraries are jsvg-1.0.0, flatlaf-extras-3.2 and flatlaf-3.1.1.
If needed I made a project just with the data necessary to cause this issue and I can share it
The text was updated successfully, but these errors were encountered: