-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: 5.7.1
-
Fix Version/s: None
-
Component/s: Image Management
-
Tags:
We recently ran into an OutOfMemoryException using Nuxeo 5.7.1
After analyzing the heap dump with Eclipse Memory Analyzer it turns out that 90% of the memory was held by nearly 150 instances of JPEGImagerReader.
According to the ImageReader documentation, one has to call dispose() to free the internal memory.
http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageReader.html#dispose()
public void dispose()
It is important for applications to call this method when they know they will no longer be using this ImageReader. Otherwise, the reader may continue to hold on to resources indefinitely.
After doing some research it looks like it.tidalwave.image.mistral is NOT calling ImageReader.dispose() when an exception occured during metadata extraction.
I checked the source of the latest version of mistral (1.0-ALPHA-2) which is now called org.imajine and it still doesn't call dispose() in case of an exception (see https://bitbucket.org/tidalwave/mistral-src/src/ea3263352a10b0481fc7120ee713f7ee4e1390c8/modules/Core/src/main/java/org/imajine/image/op/ReadOp.java?at=1.0-ALPHA-2).
So upgrading mistral wouldn't solve the issue. Not sure how a fix would look like. Maybe someone smarter than me can come up with something.