To reduce the memory consumption caused by converting documents referencing many or large images, set the processing preference PROCESSING_PREFERENCES_SAVE_MEMORY_IMAGES:


config.setProcessingPreferences(ProcessingPreferences.SAVE_MEMORY_IMAGES);


This setting will have an impact on the performance and should therefore only be used when necessary.