Mercurial > hg > truffle
diff src/share/vm/prims/jni.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 | e9140bf80b4a |
children | 957c266d8bc5 da91efe96a93 |
line wrap: on
line diff
--- a/src/share/vm/prims/jni.cpp Wed Jun 27 15:23:36 2012 +0200 +++ b/src/share/vm/prims/jni.cpp Thu Jun 28 17:03:16 2012 -0400 @@ -33,6 +33,7 @@ #ifndef SERIALGC #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #endif // SERIALGC +#include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/gcLocker.inline.hpp" #include "memory/oopFactory.hpp" @@ -3270,7 +3271,7 @@ int s_len = java_lang_String::length(s); typeArrayOop s_value = java_lang_String::value(s); int s_offset = java_lang_String::offset(s); - jchar* buf = NEW_C_HEAP_ARRAY(jchar, s_len + 1); // add one for zero termination + jchar* buf = NEW_C_HEAP_ARRAY(jchar, s_len + 1, mtInternal); // add one for zero termination if (s_len > 0) { memcpy(buf, s_value->char_at_addr(s_offset), sizeof(jchar)*s_len); } @@ -3363,7 +3364,7 @@ #endif /* USDT2 */ oop java_string = JNIHandles::resolve_non_null(string); size_t length = java_lang_String::utf8_length(java_string); - char* result = AllocateHeap(length + 1, "GetStringUTFChars"); + char* result = AllocateHeap(length + 1, mtInternal); java_lang_String::as_utf8_string(java_string, result, (int) length + 1); if (isCopy != NULL) *isCopy = JNI_TRUE; #ifndef USDT2 @@ -3619,7 +3620,7 @@ * Avoid asserts in typeArrayOop. */ \ result = (ElementType*)get_bad_address(); \ } else { \ - result = NEW_C_HEAP_ARRAY(ElementType, len); \ + result = NEW_C_HEAP_ARRAY(ElementType, len, mtInternal); \ /* copy the array to the c chunk */ \ memcpy(result, a->Tag##_at_addr(0), sizeof(ElementType)*len); \ } \ @@ -3656,7 +3657,7 @@ * Avoid asserts in typeArrayOop. */ \ result = (ElementType*)get_bad_address(); \ } else { \ - result = NEW_C_HEAP_ARRAY(ElementType, len); \ + result = NEW_C_HEAP_ARRAY(ElementType, len, mtInternal); \ /* copy the array to the c chunk */ \ memcpy(result, a->Tag##_at_addr(0), sizeof(ElementType)*len); \ } \