Memory enhancements as described in GROOVY-6171

See https://jira.codehaus.org/browse/GROOVY-6171