comparison src/share/vm/prims/jvmtiEnvBase.cpp @ 6197:d2a62e0f25eb

6995781: Native Memory Tracking (Phase 1) 7151532: DCmd for hotspot native memory tracking Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd Reviewed-by: acorn, coleenp, fparain
author zgu
date Thu, 28 Jun 2012 17:03:16 -0400
parents e6b1331a51d2
children 957c266d8bc5 da91efe96a93
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
379 if (prefix_count == 0 || !is_valid()) { 379 if (prefix_count == 0 || !is_valid()) {
380 _native_method_prefix_count = 0; 380 _native_method_prefix_count = 0;
381 _native_method_prefixes = NULL; 381 _native_method_prefixes = NULL;
382 } else { 382 } else {
383 // there are prefixes, allocate an array to hold them, and fill it 383 // there are prefixes, allocate an array to hold them, and fill it
384 char** new_prefixes = (char**)os::malloc((prefix_count) * sizeof(char*)); 384 char** new_prefixes = (char**)os::malloc((prefix_count) * sizeof(char*), mtInternal);
385 if (new_prefixes == NULL) { 385 if (new_prefixes == NULL) {
386 return JVMTI_ERROR_OUT_OF_MEMORY; 386 return JVMTI_ERROR_OUT_OF_MEMORY;
387 } 387 }
388 for (int i = 0; i < prefix_count; i++) { 388 for (int i = 0; i < prefix_count; i++) {
389 char* prefix = prefixes[i]; 389 char* prefix = prefixes[i];
1148 return JVMTI_ERROR_NONE; 1148 return JVMTI_ERROR_NONE;
1149 } 1149 }
1150 1150
1151 ResourceTracker::ResourceTracker(JvmtiEnv* env) { 1151 ResourceTracker::ResourceTracker(JvmtiEnv* env) {
1152 _env = env; 1152 _env = env;
1153 _allocations = new (ResourceObj::C_HEAP) GrowableArray<unsigned char*>(20, true); 1153 _allocations = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<unsigned char*>(20, true);
1154 _failed = false; 1154 _failed = false;
1155 } 1155 }
1156 ResourceTracker::~ResourceTracker() { 1156 ResourceTracker::~ResourceTracker() {
1157 if (_failed) { 1157 if (_failed) {
1158 for (int i=0; i<_allocations->length(); i++) { 1158 for (int i=0; i<_allocations->length(); i++) {