Details
-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
Description
Currently AbstractIterator (superclass of LazyIterator and EagerIterator) always allocates an Object[] array of size fetchSize, even when the actual number of results is smaller than fetchSize.
This is especially problematic when the user wants to fetch all the results at once (by setting fetchSize to a very large number such as Integer.MAX_VALUE). This results in an OutOfMemoryError: Requested array size exceeds VM limit.
Since the number of results is known up-front, AbstractIterator can allocate a smaller array.