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
memory issue with JFileChooser #284
Comments
Just want to ensure - which version are you using? Because last released version (v1.28) had a few major issues with memory usage including issue with preview generation in JFileChooser which I have fixed some time ago. You can find v1.29 pre-release artifacts here: I just tried opening a few folders with 10k+ image files and just wandering around file system - file chooser might take up to 100 or 200 mb of memory due to large preview image generation but that memory is almost instantly released. Selecting large amount of files doesn't seem to use a lot of memory as well. Also, if you don't want it to waste any memory at all you can switch off image preview generation: final WebFileChooser chooser = new WebFileChooser ();
chooser.setGenerateThumbnails ( false ); With this file chooser won't require large chunks of free memory at all. |
I'm using the latest one 1.29. opening the folder is fast without any issue. selecting all the files (>3000) is the issue. disable generating the thumbnails didn't help. the program run with 512 mb, i tried it with 1gb as well. i used visualvm to track the memory and it seems there is a spike with the exception and after that it went down and everything starts to work. i will create a test case and submit it here |
Sure, looking forward to test it out :) I tried a few more cases but still no luck - didn't find any noticeable memory spikes or exceptions. Also one thing that caught my attention - the stack trace you have provided seems to point at the text field, but it is cannot be active at the same time with multiselection. So it is pretty strange if this is exactly the exception you got when selected a lot of files. |
this code generates the error for me:
even when using -Xmx512m |
I just tried it on ~14000 images (changed "bok" to "png") with -Xmx100m and it had around 30-40 free MB of memory after selecting all the files. It is indeed not optimized for such large amount of files - probably some rendering similar to list should be used there - though I still don't see any memory leaks or issues there. Unless you are really low on memory and file chooser tries to either generte a big image preview or just select a lot of files. Basically the selection area generates components for each selected file and this isn't too good if you have a lot of them. I will mark this issue as an enhancement and will certainly replace this component with something better. |
Probably this is something OS or JDK -related. Not sure why, but it could be. |
There was actually an issue with thumbnails generator - it was not releasing some of memory used for thumbnails generation and was slowly moving towards OOM exception. This have been fixed a while ago and shouldn't happen on |
Hi Mikle,
I'm opening more than 3,000 files in JFileChooser. it throwns OutOfMemoryError
it is thrown only when selecting these files. jfilechooser will work after throwing the exception (after one minute) and all the files are selected correctly.
it might not be an issue since the number of files are big but any enhancement would be great.
The text was updated successfully, but these errors were encountered: