GitHub user spmallette opened a pull request:
https://github.com/apache/tinkerpop/pull/541
TINKERPOP-1560 Used ManagedConcurrentValueMap in GremlinGroovyClassLoader
https://issues.apache.org/jira/browse/TINKERPOP-1560
By configuring the `ManagedConcurrentValueMap` to have weak references, the
`GremlinGroovyClassLoader`, and therefore the `GremlinGroovyScriptEngine`, are
now able to "forget" classes that are no longer used. It was determined that
the cache of these classes would grow indefinitely for each script passed to
the `GremlinGroovyScriptEngine`, thus allowing the metaspace to continue to
grow. It isn't really possible to write tests to verify that this change works,
but I did test manually by watching memory usage in a profiler and could see
that metaspace memory stayed stable and that classes were unloading from the
classloader over time.
@BrynCooke could you please give a look at this one when you get a chance?
VOTE +1
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/tinkerpop TINKERPOP-1560
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/541.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #541
----
commit 061bbc42cda701b521c742a319f762d9af5741db
Author: Stephen Mallette <[email protected]>
Date: 2017-01-20T16:54:45Z
TINKERPOP-1560 Used ManagedConcurrentValueMap in GremlinGroovyClassLoader
By configuring the ManagedConcurrentValueMap to have weak references, the
GremlinGroovyClassLoader, and therefore the GremlinGroovyScriptEngine, are now
able to "forget" classes that are no longer used. It was determined that the
cache of these classes would grow indefinitely for each script passed to the
GremlinGroovyScriptEngine, thus allowing the metaspace to continue to grow. It
isn't really possible to write tests to verify that this change works, but I
did test manually by watching memory usage in a profiler and could see that
metaspace memory stayed stable and that classes were unloading from the
classloader over time.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---