0

I created a Java Spring Boot application for a REST product catalog that gets it's info from a remote database where I only have access to a materialized view that rebuilds itself every day. It has a field with large images up to 5 megabytes long.

When I read this view in search for updates, I pass these images to my own system file (register the filename in my own db) but before it, I use Thumbnailator plugin to resize the images in two versions (thumb and fullscreen) with no more than 20 kilobytes each pair.

The problem is that during the process I receive a Java Heap Error:

    java.lang.OutOfMemoryError: Java heap space

I tried to fix that using Slice class to paginate the view records (5 records at a time, with a for loop converting 1 file at a time), but no much better results achieved, so I searched a little more and saw this post where I should use -Xmx6g when loading the JAR file, but it is not working either.

It seems that Java VM, Spring Framework, TomCat, (or my code), is not garbaging memory correctly.

I wish to know if there is a standard heap start and max value that could handle regular database and image processing without crashing; or if it is a known bug in one of those parts mentioned above.

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
NaN
  • 8,596
  • 20
  • 79
  • 153
  • 1
    mmm. a database to save files. Anyway, try getting one image at a time. – Laurent B Jan 30 '18 at 16:31
  • @RylanHoward not sure we are talking about the same kind of perspective (64MB heap vs 5MB images loaded on 6GB heap) – Laurent B Jan 30 '18 at 16:32
  • No where in this post did I find a valid question. Sounds like you identified an issue and don't know how to take it from there. Please edit your post and include a question which can be answered. – Christopher Jan 30 '18 at 16:48
  • @LaurentB it already one file at a time. I store the images FROM remote database to in my file system. – NaN Jan 30 '18 at 17:16

0 Answers0