Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5934

java.lang.OutOfMemoryError through Iterator.collectEntries and others (part 1: handle collectEntries)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.4
    • 2.1.0-rc-3, 2.1.0
    • groovy-jdk
    • None

    Description

      DGM.collectEntries(Iterator, ...) naively calls toList(Iterator<T> self) to convert the Iterator to a list. There's no need to do this since iterator suffices to collect the entries. Even worse, toList uses ArrayList what may lead to multiple reallocations when the ArrayList's capacity must be enlarged.

      Error:
      Caught: java.lang.OutOfMemoryError: GC overhead limit exceeded

      The same problems may occur when calling other methods that internally convert Iterator to lists.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              veita Alexander Veit
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: