Groupdocs conversion - OOM heap space when converting high resolution image to pdf | CONVERSIONJAVA-1853

We are using Groupdocs conversion 22.8.1, to convert documents to PDF,
however when converting a high resolution image, the conversion fails with the exception -
OutOfMemoryError Java heap space

below is the code snippet used to convert -
Convertor converter = new Converter(ImagePath.toString());
PdfConvertOptions options = new PdfConvertOptions();
converter.convert(pdfPath.toString(), options); //<- exception here

I do know that incresing JVM heap memory with option -Xmx, will resolve this.
we currently assign 500mb to this microservice.

but could you please let us know what is the minimum required memory for groupdocs conversion.
because right now this is one conversion, what if two conversion were to happen by two different user of our microservice, then even 1gb will not suffice?

and is there any option to control the memory usage of conversion.
sample image-

to reproduce, set JVM heap memory to 500 mb using - -Xmx500m,
and try to convert the sample image to pdf

1 Like

@DineshSolanki

We are investigating this scenario. Your investigation ticket ID is CONVERSIONJAVA-1853.

@DineshSolanki

Please add some memory, for example -Xmx1024M.
Note that Bitmap of such size requires a lot of memory because it has high resolution and it is decompressing during the conversion.

Even with - Xmx1024m, it gives OOM error when two such conversions are attempted at the same time.

Isn’t it too much for something such as a 10Mb image to convert to pdf

@DineshSolanki

We’ll further look into this scenario. You’ll be notified in case of any update.

@DineshSolanki

We’ve fixed this issue and the release will be available sooner. As the release gets onboard, we’ll notify you.

1 Like

Thank you @Atir_Tahir, looking forward to the release.

@DineshSolanki

You are welcome.

For any visitor, this fix has been released in 22.12 GroupDocs.Conversion for Java 22.12 Release Notes

Will test and post result also

The issues you have found earlier (filed as CONVERSIONJAVA-1853) have been fixed in this update. This message was posted using Bugs notification tool by Atir_Tahir

After upgrading to this version, we are getting exception -

class com.groupdocs.conversion.internal.c.a.s.exceptions.G: License parsing error —> java.lang.IllegalArgumentException: Property ‘http://javax.xml.XMLConstants/property/accessExternalDTD’ is not recognized.

Previous version works fine.

@DineshSolanki

Could you please share the sample application along with source file(s)?

Hi atir, no need, it was issue with “xecers” and ‘xml-apis’ dependency in maven, after excluding it from my pom, it worked, might have been the way it tries to parse xml. Anyway it’s not recommended nowdays, also haven’t occurred the oom issue for same scanrio so, I guess this release really fixed that, thank a lot to you and the team. Appriciated.

1 Like

@DineshSolanki

You are welcome.

1 Like