Open daynok opened 5 years ago
Hey @daynok :wave: Please provide the stacktrace, thanks
Stack trace:
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
at com.sun.jna.Pointer.getByteArray(Pointer.java:725)
at org.ghost4j.Ghostscript$10.callback(Ghostscript.java:493)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:470)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:500)
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy31.gsapi_init_with_args(Unknown Source)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:350)
at org.ghost4j.renderer.SimpleRenderer.run(SimpleRenderer.java:105)
at org.ghost4j.renderer.AbstractRemoteRenderer.render(AbstractRemoteRenderer.java:86)
at org.ghost4j.renderer.AbstractRemoteRenderer.render(AbstractRemoteRenderer.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
at com.sun.jna.Pointer.getByteArray(Pointer.java:725)
at org.ghost4j.Ghostscript$10.callback(Ghostscript.java:493)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:470)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:500)
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy31.gsapi_init_with_args(Unknown Source)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:350)
at org.ghost4j.renderer.SimpleRenderer.run(SimpleRenderer.java:105)
at org.ghost4j.renderer.AbstractRemoteRenderer.render(AbstractRemoteRenderer.java:86)
at org.ghost4j.renderer.AbstractRemoteRenderer.render(AbstractRemoteRenderer.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
JNA: Callback org.ghost4j.Ghostscript$10@71b3bc45 threw the following exception:
java.lang.OutOfMemoryError: Java heap space
Q. Is there a limit on no of pages that GS can process at once? This error comes while processing a pdf with pages > 500. GS was able to process to 147 pages and post that it threw the error.
Trying to evaluate ghost4j but am getting an outofmemory error on ghost4j 1.0.1 My env: 64 bit linux (arch) Java 1.8.0_131
Tried multiple times to attach pdf to this ticket.. github kept giving me errors so created a repo with support files
https://github.com/daynok/ghost4j-outofmemory
Ran pdfinfo on the pdf and as far as I can tell it looks good. Also opened the pdf in firefox without issue.
From what I can tell the outofmemory error gets thrown at renderer.render(document);
I'm not sure if I'm doing something wrong programmatically or what.
End goal, convert pdf pages to png's.
package com.medata;
import java.io.File; import org.ghost4j.document.PDFDocument; import org.ghost4j.renderer.SimpleRenderer;
public class Driver {