Elog crash on java out of heap memory
The elog began crashing tonight on java heap memory problems. The problem seems to be with reading image files with ImageIO and then trying to create thumbnails of them.
#5 Updated by Kyle Hazelwood almost 6 years ago
- File ElogHeapErrorOldWay.PNG ElogHeapErrorOldWay.PNG added
- File ElogHeapErrorNewWayFinal.PNG ElogHeapErrorNewWayFinal.PNG added
I implemented a new elog image thumbnail creation scheme:
- The elog originally would read in the entire file/image to determine its aspect ratio to scale the image. This is fine for small images of low resolution, the problem occurs when images are of high resolution and compressed. When compressed images are read they are uncompressed; a 5MB jpeg may be hundreds of MBs when uncompressed. The new way doesn't require reading the entire image to obtain the aspect ratio thus eliminating the primary cause of the heap memory problem
- The old way relied on java graphics 2D rendering hints to lower the quality of the thumbnails to decrease their size and the load time on the client side. This worked fine but required more memory on the server side as it was still reading the entire image to do this. In the new way there is a sampling quality factor that determines the quality of the thumbnail image.
- The new scheme determines how many rows/columns of pixels it must read based on the aspect ratio of the image and the sampling quality factor given.