6995781: Native Memory Tracking (Phase 1)

7151532: DCmd for hotspot native memory tracking

Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd

Reviewed-by: acorn, coleenp, fparain
This commit is contained in:
Zhengyu Gu 2012-06-28 17:03:16 -04:00
parent 8e42425c92
commit a39b17624a
315 changed files with 7245 additions and 1477 deletions

View file

@ -989,7 +989,7 @@ void instanceKlass::do_nonstatic_fields(FieldClosure* cl) {
fieldDescriptor fd;
int length = java_fields_count();
// In DebugInfo nonstatic fields are sorted by offset.
int* fields_sorted = NEW_C_HEAP_ARRAY(int, 2*(length+1));
int* fields_sorted = NEW_C_HEAP_ARRAY(int, 2*(length+1), mtClass);
int j = 0;
for (int i = 0; i < length; i += 1) {
fd.initialize(as_klassOop(), i);
@ -1009,7 +1009,7 @@ void instanceKlass::do_nonstatic_fields(FieldClosure* cl) {
cl->do_field(&fd);
}
}
FREE_C_HEAP_ARRAY(int, fields_sorted);
FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass);
}
@ -1236,7 +1236,7 @@ jmethodID instanceKlass::get_jmethod_id(instanceKlassHandle ik_h, methodHandle m
if (length <= idnum) {
// allocate a new cache that might be used
size_t size = MAX2(idnum+1, (size_t)ik_h->idnum_allocated_count());
new_jmeths = NEW_C_HEAP_ARRAY(jmethodID, size+1);
new_jmeths = NEW_C_HEAP_ARRAY(jmethodID, size+1, mtClass);
memset(new_jmeths, 0, (size+1)*sizeof(jmethodID));
// cache size is stored in element[0], other elements offset by one
new_jmeths[0] = (jmethodID)size;
@ -1397,7 +1397,7 @@ void instanceKlass::set_cached_itable_index(size_t idnum, int index) {
// cache size is stored in element[0], other elements offset by one
if (indices == NULL || (length = (size_t)indices[0]) <= idnum) {
size_t size = MAX2(idnum+1, (size_t)idnum_allocated_count());
int* new_indices = NEW_C_HEAP_ARRAY(int, size+1);
int* new_indices = NEW_C_HEAP_ARRAY(int, size+1, mtClass);
new_indices[0] = (int)size;
// copy any existing entries
size_t i;
@ -1933,7 +1933,7 @@ void instanceKlass::release_C_heap_structures() {
// deallocate the cached class file
if (_cached_class_file_bytes != NULL) {
os::free(_cached_class_file_bytes);
os::free(_cached_class_file_bytes, mtClass);
_cached_class_file_bytes = NULL;
_cached_class_file_len = 0;
}
@ -2530,7 +2530,7 @@ void instanceKlass::add_previous_version(instanceKlassHandle ikh,
// This is the first previous version so make some space.
// Start with 2 elements under the assumption that the class
// won't be redefined much.
_previous_versions = new (ResourceObj::C_HEAP)
_previous_versions = new (ResourceObj::C_HEAP, mtClass)
GrowableArray<PreviousVersionNode *>(2, true);
}
@ -2556,7 +2556,7 @@ void instanceKlass::add_previous_version(instanceKlassHandle ikh,
("add: all methods are obsolete; flushing any EMCP weak refs"));
} else {
int local_count = 0;
GrowableArray<jweak>* method_refs = new (ResourceObj::C_HEAP)
GrowableArray<jweak>* method_refs = new (ResourceObj::C_HEAP, mtClass)
GrowableArray<jweak>(emcp_method_count, true);
for (int i = 0; i < old_methods->length(); i++) {
if (emcp_methods->at(i)) {
@ -2948,7 +2948,7 @@ PreviousVersionInfo* PreviousVersionWalker::next_previous_version() {
while (_current_index < length) {
PreviousVersionNode * pv_node = _previous_versions->at(_current_index++);
PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP)
PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP, mtClass)
PreviousVersionInfo(pv_node);
constantPoolHandle cp_h = pv_info->prev_constant_pool_handle();