I have a function that loads several serialized objects from the file system by using Java 5 FutureTask
. My computer memory should not be an issue.
If I call the function within a main method everything works fine but if I call the function from within the init()
or in a static block
of a HTTPServlet
I get all kinds of OutOfMemoryException
(usually Java heap space)...
Does anyone know why by using a Servlet I end up hitting this issue? Can FutureTasks and Servlets conflict in any way and what can I do to understand/fix the issue?