Excel to PDF conversion crashing JVM in Webspere - java.lang.OutOfMemoryError: Java heap space

Hello,
We are using groupdocs-conversion-18.7.jar to convert files to PDF format. Some Excel files are coming through the system with very large print areas (up to 100,000 pages). When the conversion is attempted it is eating up all of the memory on the server and any additional activity results in java.lang.OutOfMemoryError: Java heap space errors. Our service is deployed in Websphere along side other applications. Once GroupDocs starts the conversion it is just churning away at converting the document and eventually the server becomes unresponsive crashing the entire JVM and must be re-booted. What is your recommendation in this situation? How can we error out gracefully from this if the conversion is taking too long or eating up too much memory? Is there anything we can use in the current API to check the properties of the document beforehand? Does the latest version of the API have anything that would help? I can provide a sample file and logs if needed, but would need to send that info privately. Our code is below:

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	ArrayList<Part> parts = new ArrayList<Part>(request.getParts());
	new License().setLicense(ConnectionHandler.class.getClassLoader().getResourceAsStream("GroupDocs.Conversion.lic"));
	
	ConvertedDocument document = null;
	InputStream inputStream = parts.get(0).getInputStream();
	GroupDocsOutputStream outputStream = new GroupDocsOutputStream(response.getOutputStream());
	try {
		String filename = parts.get(0).getName();
		ConversionConfig conversionConfig = new ConversionConfig();
		ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);
		PdfSaveOptions saveOptions = new PdfSaveOptions();
		EmailOptions emailOptions = saveOptions.getEmailOptions();
		emailOptions.setDisplayHeader(true);
		emailOptions.setDisplayEmailAddress(false);
		emailOptions.setDisplayFromEmailAddress(false);
		emailOptions.setDisplayToEmailAddress(false);
		emailOptions.setDisplayCcEmailAddress(false);
		emailOptions.setDisplayBccEmailAddress(false);
		
		CellsOptions cellsoptions =  saveOptions.getCellsOptions();
		cellsoptions.setOnePagePerSheet(onePagePerSheet);
		cellsoptions.setSkipEmptyRowsAndColumns(skipEmptyRowsAndColumns);
		
		
		document = conversionHandler.convert(inputStream, filename, saveOptions);
		
		document.save(outputStream);
		
	} catch (Exception e) {
		System.out.println("ConvertDocumentToPDF >> Exception reached");
		e.printStackTrace();
	} finally {
		System.out.println("ConvertDocumentToPDF >> Input stream closed");
		inputStream.close();
	}
}

@mwillisECM,

Can you please share the problematic file(s)? You can share them in private message.

Are you setting it true or false? Default value is true. We’d recommend you to skip empty rows and columns and then see if process improves.
Also specify either you are evaluating API in trial mode or you have a license?

We have that setting defaulted to true but do allow it to be configured to false. We have a license.

We are also having issues with hung threads when a file has macros or is password protected.

@mwillisECM,

You have to maximize size of the heap. This issue appears when you try to execute a large application/process in a small sized java heap space. So, the process just requires more Java heap space than available to operate normally.
Can you please specify the memory (RAM) that is dedicated to the VM? Are you able to reproduce the issue by increasing VM arguments (e.g. -Xms512M -Xmx5024M set it to the maximum value)?

This is also due to small java heap space.
Please try to maximize heap space and then try to execute process.