Free Support Forum - aspose.com

DWG to PDF conversion error for >10 MB .dwg files

We are using the Asppose.CAD java libraries. We are facing the out of memory exception when we are converting the .dwg to .pdf.

We are using the .dwg files which are greater than 10 MB.

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3236)
at sun.misc.IOUtils.readFully(IOUtils.java:60)
at java.util.jar.JarFile.getBytes(JarFile.java:425)
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193)
at java.util.jar.JarFile.getManifest(JarFile.java:180)
at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:981)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:450)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.aspose.cad.internal.fG.k.k(Unknown Source)
at com.aspose.cad.internal.fG.n.a(Unknown Source)
at com.aspose.cad.internal.fG.k.aO(Unknown Source)
at com.aspose.cad.internal.fI.Y.a(Unknown Source)
at com.aspose.cad.internal.fI.Y.e(Unknown Source)
at com.aspose.cad.internal.fG.k.a(Unknown Source)
at com.aspose.cad.internal.fG.bk.a(Unknown Source)
at com.aspose.cad.internal.fG.bj.load(Unknown Source)
at com.aspose.cad.Image.a(Unknown Source)
at com.aspose.cad.Image.load(Unknown Source)
at com.aspose.cad.examples.DWGDrawings.ConvertDWGFileToPDF.main(ConvertDWGFileToPDF.java:19)

@imaginerays

Please try using latest Aspose.CAD for Java on your end and also consider increasing the heap size on your end. I hope the heap size increase will resolve the issue.

Is there a recommended setting for heap size? Normally i could see even after changing heapsize setting to -Xmx6G the process is running for indefinite time and failing with the same error.

I am using the 20.4 version. let me check with latest 20.10

@imaginerays

Normally 4G to 6G heap size is used but for large files and more complex operations, you have to increase it further.