Missing ResourceMark in TraceStream::print_val()
梅路峣(云达)
yunda.mly at taobao.com
Tue Apr 15 09:54:38 UTC 2014
Hi all,
In TraceStream::print_val(const char* label, const Klass* const val) and
TraceStream::print_val(const char* label, const Method* const val),
Symbol::as_C_string() and Method::name_and_sig_as_C_string() are called in
line 93 and 106 of traceStream.hpp
<http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/4dedef5e51ed/src/share/vm
/trace/traceStream.hpp> , respectively. Since they both use
NEW_RESOURCE_ARRAY to allocate memory, I think ResourceMark should be used.
Please see the patch below:
diff -r 4dedef5e51ed src/share/vm/trace/traceStream.hpp
--- a/src/share/vm/trace/traceStream.hpp Fri Apr 11 11:23:30 2014 -0700
+++ b/src/share/vm/trace/traceStream.hpp Tue Apr 15 15:50:31 2014 +0800
@@ -86,6 +86,7 @@
// necessary ResourceMark for the resource allocations below.
// See traceEventClasses.xsl for details.
void print_val(const char* label, const Klass* const val) {
+ ResourceMark rm;
const char* description = "NULL";
if (val != NULL) {
Symbol* name = val->name();
@@ -101,6 +102,7 @@
// necessary ResourceMark for the resource allocations below.
// See traceEventClasses.xsl for details.
void print_val(const char* label, const Method* const val) {
+ ResourceMark rm;
const char* description = "NULL";
if (val != NULL) {
description = val->name_and_sig_as_C_string();
Regards,
Yunda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20140415/6febac88/attachment.html>
More information about the serviceability-dev
mailing list