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

Seriously Large Memory Leak (reproducable)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-6, 1.0-beta-7
    • 1.0-beta-10
    • groovy-jdk
    • None
    • Windows XP SP2, Linux 9.0, 1GB Ram, JDK 1.4.2-4 (server or client), Eclipse 3.0.1

    Description

      We have a server process that routinely evaluates thousands of simple grovvy expressions daily. Our server process consistently needs to be restarted every two days due to an out of memory error.

      We've tracked this down to a leak in groovy. (we've proven this by removing groovy from our application and hard coded the expression results)

      If you execute the following piece of code, groovy will cause an out-of-memory error. It consumes over 100mb of heap space, just to evaluated 3 + 4 ten thousand times!

      Assuming this is correct, I suggest no one uses groovy in production systems until this is resolved. (I'll have a crack at it myself in the next few days)

      //--------------------------

      import groovy.lang.GroovyShell;

      public class Main {

      public static void main(String[] args) throws Exception {

      GroovyShell groovyShell = new GroovyShell();

      for (int i = 1; i < 10000; i++)

      { Object groovyResult = groovyShell.evaluate("return 3 + 4;"); if (i % 100 == 0) System.out.print("."); }

      }
      }

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            bdube Brian Dube
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Time Spent - 2h Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - 2h Remaining Estimate - 4h
                2h