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

Memory Leak (metaClassRegistry) unable to remove metaClass based on instances

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.7
    • 2.4.6
    • groovy-runtime
    • None
    • Running from Eclipse, JBoss with jdk 1.6

    Description

      I'm using the GroovyScriptEngine in a web server environment where the scripts are provided properties on-the-fly from database objects. This is done by implementing script.metaClass.propertyMissing. When I return a value, I set the metaClass to give the returned value even more sub-properties. After processing 100k records or so, I run out of memory. I tried to write code to remove entries from the metaClassRepository, but there's no way to do it for an object instanced based metaClass. Also, I've outputed the GroovySystem.metaClassRepository.iterator().size() and it kept growing. The values are out of scope so they should get garbage collected, but the metaClasses aren't getting cleaned up.

      The workaround to this problem was to implement a groovy Proxy, though, I liked the metaClass solution better.

      Attachments

        Activity

          People

            jwagenleitner John Wagenleitner
            kimbonics Kimball C Sampson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: