dbmdz / iiif-server-hymir

Hymir is a Java based IIIF Server. It is based on "IIIF Image API Java Libraries" and "IIIF Presentation API Java Libraries" projects (see https://github.com/dbmdz)
MIT License
27 stars 7 forks source link

Always close ImageIO reader to prevent memory leaks #82

Closed jbaiter closed 5 years ago

jbaiter commented 5 years ago

We were very unhygeniec with our ImageIO readers, never calling .dispose(). This is usually not a problem with pure-Java ImageIO backends, but with the OpenJp2 plugin from imageio-jnr, the reader held a reference to some off-heap memory (~1MiB per reader) that would be leaked without a call to dispose().