Java exception - OutOf MemoryError

Jimmy Cap 5 years ago updated by Elouan 3 years ago 14
I'm scanning a significant library of PDF files (~1000) titles and about every 500 or so I get the following error:

20150610 10:12:08 [Scanner thread] ERROR com.ubooquity.Ubooquity - Uncaught exception on thread: Scanner threadjava.lang.OutOfMemoryError: Java heap space.

This is on WS2012R2, Java 8u45 x64.


Under review
There is probably a memory leak in the code doing the scan. I'll investigate someday, but finding the root cause can take time.
In the meantime you can either relaunch the scan after each crash (not a very satisfying solution but once the initial scan is finished, you should not have the problem ever again) or give Ubooquity more memory to work with.
Thanks, appreciate the reply.

Tom, could you elaborate on how to allocate more memory to Ubooquity? I'm using Win10 and running into the OutOfMemory error. I read the FAQ on allocating more memory, but I don't know what startup script you're referring to in the FAQ. When I start Ubooquity, I just launch the Ubooquity.jar. Do I need to unpack the .jar and dig into one of the files there? Which one, there's a lot of them?



The script mentioned in the FAQ is for Linux, so it won't help you.

To set the quantity of memory Java can use, you have to launch Ubooquity using the command line.

Open a DOS shell and go in the directory which contains your Ubooquity.jar file.

Then type something like that:

"C:\Program Files\Java\jdk1.8.0_92\bin\javaw.exe" -Xmx1500m -jar Ubooquity.jar
The jdk1.8.0_92 folder is specific to my PC, replace it with the Java version you have (it can be a JRE too, not necessarily a JDK).

To choose the memory amount, replace 1500m with the value you want (1500m means 1500 megabytes).

To easily reuse the command line, you can paste it in a text file and rename the text file to something.bat

I got a lot of such errors with pdf files. I've found that when converting them to cbz or cbr those memory leaks have disappeared completely... so I basically converted my entire collection to cbz and I've never had those problem since

Of course, it would be nice to inverstigate on why the pdf format is causing such rpoblems

I started to notice this lately. Ubooquity is using 7GB of Ram

7GB is an insane amount for something as small as Ubooquity.

But I still don't know if there is a memory leak or if the problem is limited to PDF handling.

Do you have PDF files ?

Ok, that's not good.

The next version (no ETA) will contains big changes and some fixes related to memory consumption.

I can't promise it will fix your problem but that's the best I can offer for now.

Under system information its says Max memory 247mb . I keep getting the out of memory issue trying to sync my ecomics. I've added the line -Xmx4096m to the java line and I still keep getting the out of memory problem.

if your system has 256Mb of memory, you must set a limit lower than this or you will get memory errors. i have a ds212 with same memory and have set the limit to 128mb for ubooquity (so that m'y synology can still operate even with ubooquity scanning in the bzckground)