JDK-6333959 : DisposeEnvironment does not free the tag map table
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-10-07
  • Updated: 2010-04-02
  • Resolved: 2005-11-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u8Fixed 6 b60Fixed
Description
One of the profiler vendors has observed that DisposeEnvironment does not release all memory. The problem is not noticed unless a tag related function is used (SetTag, GetObjectsWithTags, ...). If the environment is disposed after tag related functions have been used then some resources held by the environment are not released.

Comments
SUGGESTED FIX I tracked down the issue to the JvmtiTagHashmap class in jvmtiTagMap.cpp. It is missing a destructor to free the table. This will fix it for us: ~JvmtiTagHashmap() { if (_table != NULL) { os::free((void*)_table); } }
07-10-2005

EVALUATION I checked into it and JvmtiTagHashmap is missing a destructor to os::free the embedded table. For most agents this is a non-issue because the environment is created at onload time and is never disposed. However for agents that create a temporary environment for tagging (like the JDWP agent does) then the issue can be observed. The submitter has provided a test case that clearly demonstrates the bug and the fix is trivial and low risk.
07-10-2005