Mercurial > hg > truffle
diff src/share/vm/utilities/ostream.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 | 11c26bfcf8c7 |
children | 957c266d8bc5 4ee06e614636 |
line wrap: on
line diff
--- a/src/share/vm/utilities/ostream.cpp Wed Jun 27 15:23:36 2012 +0200 +++ b/src/share/vm/utilities/ostream.cpp Thu Jun 28 17:03:16 2012 -0400 @@ -384,7 +384,7 @@ if (_file != NULL) { if (_need_close) fclose(_file); _file = NULL; - FREE_C_HEAP_ARRAY(char, _file_name); + FREE_C_HEAP_ARRAY(char, _file_name, mtInternal); _file_name = NULL; } } @@ -392,7 +392,7 @@ rotatingFileStream::rotatingFileStream(const char* file_name) { _cur_file_num = 0; _bytes_writen = 0L; - _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10); + _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal); jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num); _file = fopen(_file_name, "w"); _need_close = true; @@ -401,7 +401,7 @@ rotatingFileStream::rotatingFileStream(const char* file_name, const char* opentype) { _cur_file_num = 0; _bytes_writen = 0L; - _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10); + _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal); jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num); _file = fopen(_file_name, opentype); _need_close = true; @@ -524,7 +524,7 @@ } // Create big enough buffer. - char *buf = NEW_C_HEAP_ARRAY(char, buffer_length); + char *buf = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal); strcpy(buf, ""); if (force_directory != NULL) { @@ -549,7 +549,7 @@ // %%% Need a MutexLocker? const char* log_name = LogFile != NULL ? LogFile : "hotspot.log"; const char* try_name = make_log_name(log_name, NULL); - fileStream* file = new(ResourceObj::C_HEAP) fileStream(try_name); + fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); if (!file->is_open()) { // Try again to open the file. char warnbuf[O_BUFLEN*2]; @@ -557,18 +557,18 @@ "Warning: Cannot open log file: %s\n", try_name); // Note: This feature is for maintainer use only. No need for L10N. jio_print(warnbuf); - FREE_C_HEAP_ARRAY(char, try_name); + FREE_C_HEAP_ARRAY(char, try_name, mtInternal); try_name = make_log_name("hs_pid%p.log", os::get_temp_directory()); jio_snprintf(warnbuf, sizeof(warnbuf), "Warning: Forcing option -XX:LogFile=%s\n", try_name); jio_print(warnbuf); delete file; - file = new(ResourceObj::C_HEAP) fileStream(try_name); - FREE_C_HEAP_ARRAY(char, try_name); + file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); + FREE_C_HEAP_ARRAY(char, try_name, mtInternal); } if (file->is_open()) { _log_file = file; - xmlStream* xs = new(ResourceObj::C_HEAP) xmlStream(file); + xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file); _outer_xmlStream = xs; if (this == tty) xtty = xs; // Write XML header. @@ -815,7 +815,7 @@ void ostream_init() { if (defaultStream::instance == NULL) { - defaultStream::instance = new(ResourceObj::C_HEAP) defaultStream(); + defaultStream::instance = new(ResourceObj::C_HEAP, mtInternal) defaultStream(); tty = defaultStream::instance; // We want to ensure that time stamps in GC logs consider time 0 @@ -833,9 +833,9 @@ gclog_or_tty = tty; // default to tty if (Arguments::gc_log_filename() != NULL) { fileStream * gclog = UseGCLogFileRotation ? - new(ResourceObj::C_HEAP) + new(ResourceObj::C_HEAP, mtInternal) rotatingFileStream(Arguments::gc_log_filename()) : - new(ResourceObj::C_HEAP) + new(ResourceObj::C_HEAP, mtInternal) fileStream(Arguments::gc_log_filename()); if (gclog->is_open()) { // now we update the time stamp of the GC log to be synced up @@ -940,7 +940,7 @@ bufferedStream::bufferedStream(size_t initial_size, size_t bufmax) : outputStream() { buffer_length = initial_size; - buffer = NEW_C_HEAP_ARRAY(char, buffer_length); + buffer = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal); buffer_pos = 0; buffer_fixed = false; buffer_max = bufmax; @@ -971,7 +971,7 @@ if (end < buffer_length * 2) { end = buffer_length * 2; } - buffer = REALLOC_C_HEAP_ARRAY(char, buffer, end); + buffer = REALLOC_C_HEAP_ARRAY(char, buffer, end, mtInternal); buffer_length = end; } } @@ -989,7 +989,7 @@ bufferedStream::~bufferedStream() { if (!buffer_fixed) { - FREE_C_HEAP_ARRAY(char, buffer); + FREE_C_HEAP_ARRAY(char, buffer, mtInternal); } }