JDK-7003271 : Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs20
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-11-29
  • Updated: 2012-10-13
  • Resolved: 2011-01-12
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.
JDK 6 JDK 7 Other
6u25Fixed 7Fixed hs20Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
It's possible today to get cumulative per-thread cpu time via the ThreadMXBean.
It would be very useful to get the cumulative per-thread number of bytes
allocated in the Java heap as well for resource management purposes.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/b1a2afa37ec4
08-01-2011

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/b1a2afa37ec4
08-01-2011

EVALUATION Ok.
13-12-2010

SUGGESTED FIX An outline of a fix is 1. Add a 64-bit cumulative byte count field to the JavaThread. 2. Increment it when a TLAB is retired or when an object is allocated directly in Eden or the old gen. For the allocate-directly-in-Eden case, a bit of compiler IR for C1 and C2 will have to be added, plus the C++ interpreter and the various interpreters will need a few lines of code added. 3. Export the field via an mbean or mxbean interface in management.cpp and jmm.h.
29-11-2010