Skip to content
Advertisement

Heap Overflow Issue when implementing and using the Printable interface

So I’ve written the class below, and it works, but we are getting some heap overflow problems when using this. The images are limited to 5 mb each. Anyone have an idea on how to solve overflowing the heap when generating the printout?

JavaScript

}

Advertisement

Answer

Without going in the specifics of your code, maybe you really need a bigger heap size to do this task. Have you tried increasing it with the flag -Xmx?

JavaScript

For instance:

JavaScript

sets the heap size to 360 Mb.

Alternatively, you can use a profiler to understand where the memory is used. See this tutorial for Eclipse.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement