United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8020943 Memory leak when GCNotifier uses create_from_platform_dependent_str()
JDK-8020943 : Memory leak when GCNotifier uses create_from_platform_dependent_str()

Details
Type:
Bug
Submit Date:
2013-07-19
Status:
Closed
Updated Date:
2014-01-15
Project Name:
JDK
Resolved Date:
2013-08-02
Component:
core-svc
OS:
Sub-Component:
java.lang.management
CPU:
Priority:
P2
Resolution:
Fixed
Affected Versions:
fcs7
Fixed Versions:
hs25 (b45)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
In jdk7 onwards, running an application and attaching jconsole activates GC Notifications in the GC MBean.

There is some overhead accounted for by ArrayNotificationBuffer, but this should stabilise.  But there remains a JNI Handle leak that can be shown with -XX:+TraceJNIHandleAllocation.

"Unreferenced" java.lang.String objects accumulate in the heap, they are the Strings from the GC name/cause, and cannot be collected.

                                    

Comments
Reproducing the leak with a simple test app that causes a lot of collections, and attaching jconsole, the leak is clear.

Testing a hotspot build where in void GCNotifier::sendNotificationInternal we replace:

Handle objName = java_lang_String::create_from_platform_dependent_str(request->gcManager->name(), CHECK);

with:  java_lang_String::create_from_str(...)

...and my test app has a stable heap, no leak (expect heap usage around 7.5MB to account for the ArrayNotificationBuffer).

                                     
2013-07-19
Going ahead with the change of the function call to avoid the leak, as it's unnecessary for the gcnotifier's strings, but following up with a separate bug on the actual leaked handle.
                                     
2013-08-02
URL:   http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/32e3bada0978
User:  kevinw
Date:  2013-08-02 14:52:30 +0000

                                     
2013-08-02
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/32e3bada0978
User:  amurillo
Date:  2013-08-09 12:44:57 +0000

                                     
2013-08-09



Hardware and Software, Engineered to Work Together