comparison src/share/vm/prims/jvmtiExport.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 4ceaf61479fc
children da91efe96a93
comparison
equal deleted inserted replaced
6174:74533f63b116 6197:d2a62e0f25eb
615 if (new_data != NULL) { 615 if (new_data != NULL) {
616 // this agent has modified class data. 616 // this agent has modified class data.
617 if (caching_needed && *_cached_data_ptr == NULL) { 617 if (caching_needed && *_cached_data_ptr == NULL) {
618 // data has been changed by the new retransformable agent 618 // data has been changed by the new retransformable agent
619 // and it hasn't already been cached, cache it 619 // and it hasn't already been cached, cache it
620 *_cached_data_ptr = (unsigned char *)os::malloc(_curr_len); 620 *_cached_data_ptr = (unsigned char *)os::malloc(_curr_len, mtInternal);
621 memcpy(*_cached_data_ptr, _curr_data, _curr_len); 621 memcpy(*_cached_data_ptr, _curr_data, _curr_len);
622 *_cached_length_ptr = _curr_len; 622 *_cached_length_ptr = _curr_len;
623 } 623 }
624 624
625 if (_curr_data != *_data_ptr) { 625 if (_curr_data != *_data_ptr) {
718 _code_size = nm->insts_size(); 718 _code_size = nm->insts_size();
719 _compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is NULL. 719 _compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is NULL.
720 JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length); 720 JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
721 } 721 }
722 ~JvmtiCompiledMethodLoadEventMark() { 722 ~JvmtiCompiledMethodLoadEventMark() {
723 FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map); 723 FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map, mtInternal);
724 } 724 }
725 725
726 jint code_size() { return _code_size; } 726 jint code_size() { return _code_size; }
727 const void *code_data() { return _code_data; } 727 const void *code_data() { return _code_data; }
728 jint map_length() { return _map_length; } 728 jint map_length() { return _map_length; }
2321 } 2321 }
2322 2322
2323 // register a stub 2323 // register a stub
2324 void JvmtiDynamicCodeEventCollector::register_stub(const char* name, address start, address end) { 2324 void JvmtiDynamicCodeEventCollector::register_stub(const char* name, address start, address end) {
2325 if (_code_blobs == NULL) { 2325 if (_code_blobs == NULL) {
2326 _code_blobs = new (ResourceObj::C_HEAP) GrowableArray<JvmtiCodeBlobDesc*>(1,true); 2326 _code_blobs = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiCodeBlobDesc*>(1,true);
2327 } 2327 }
2328 _code_blobs->append(new JvmtiCodeBlobDesc(name, start, end)); 2328 _code_blobs->append(new JvmtiCodeBlobDesc(name, start, end));
2329 } 2329 }
2330 2330
2331 // Setup current thread to record vm allocated objects. 2331 // Setup current thread to record vm allocated objects.
2355 } 2355 }
2356 2356
2357 void JvmtiVMObjectAllocEventCollector::record_allocation(oop obj) { 2357 void JvmtiVMObjectAllocEventCollector::record_allocation(oop obj) {
2358 assert(is_enabled(), "VM object alloc event collector is not enabled"); 2358 assert(is_enabled(), "VM object alloc event collector is not enabled");
2359 if (_allocated == NULL) { 2359 if (_allocated == NULL) {
2360 _allocated = new (ResourceObj::C_HEAP) GrowableArray<oop>(1, true); 2360 _allocated = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<oop>(1, true);
2361 } 2361 }
2362 _allocated->push(obj); 2362 _allocated->push(obj);
2363 } 2363 }
2364 2364
2365 // GC support. 2365 // GC support.