-1

I'm using following code to read image file of size 330MB

BufferedImage img=ImageIO.read("test.png");

How to resolve this?

Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60
Parmanand
  • 355
  • 2
  • 6
  • 15

1 Answers1

2

You need to increase the value of heap using the -Xmx. From Javadoc

Specifies the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2 MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331