src/share/vm/utilities/ostream.cpp

changeset 3901
24b9c7f4cae6
parent 3900
d2a62e0f25eb
child 3992
4ee06e614636
     1.1 --- a/src/share/vm/utilities/ostream.cpp	Fri Jun 29 17:12:15 2012 -0700
     1.2 +++ b/src/share/vm/utilities/ostream.cpp	Mon Jul 02 13:11:28 2012 -0400
     1.3 @@ -384,7 +384,7 @@
     1.4    if (_file != NULL) {
     1.5      if (_need_close) fclose(_file);
     1.6      _file      = NULL;
     1.7 -    FREE_C_HEAP_ARRAY(char, _file_name);
     1.8 +    FREE_C_HEAP_ARRAY(char, _file_name, mtInternal);
     1.9      _file_name = NULL;
    1.10    }
    1.11  }
    1.12 @@ -392,7 +392,7 @@
    1.13  rotatingFileStream::rotatingFileStream(const char* file_name) {
    1.14    _cur_file_num = 0;
    1.15    _bytes_writen = 0L;
    1.16 -  _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10);
    1.17 +  _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal);
    1.18    jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num);
    1.19    _file = fopen(_file_name, "w");
    1.20    _need_close = true;
    1.21 @@ -401,7 +401,7 @@
    1.22  rotatingFileStream::rotatingFileStream(const char* file_name, const char* opentype) {
    1.23    _cur_file_num = 0;
    1.24    _bytes_writen = 0L;
    1.25 -  _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10);
    1.26 +  _file_name = NEW_C_HEAP_ARRAY(char, strlen(file_name)+10, mtInternal);
    1.27    jio_snprintf(_file_name, strlen(file_name)+10, "%s.%d", file_name, _cur_file_num);
    1.28    _file = fopen(_file_name, opentype);
    1.29    _need_close = true;
    1.30 @@ -524,7 +524,7 @@
    1.31    }
    1.32  
    1.33    // Create big enough buffer.
    1.34 -  char *buf = NEW_C_HEAP_ARRAY(char, buffer_length);
    1.35 +  char *buf = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal);
    1.36  
    1.37    strcpy(buf, "");
    1.38    if (force_directory != NULL) {
    1.39 @@ -549,7 +549,7 @@
    1.40    // %%% Need a MutexLocker?
    1.41    const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
    1.42    const char* try_name = make_log_name(log_name, NULL);
    1.43 -  fileStream* file = new(ResourceObj::C_HEAP) fileStream(try_name);
    1.44 +  fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
    1.45    if (!file->is_open()) {
    1.46      // Try again to open the file.
    1.47      char warnbuf[O_BUFLEN*2];
    1.48 @@ -557,18 +557,18 @@
    1.49                   "Warning:  Cannot open log file: %s\n", try_name);
    1.50      // Note:  This feature is for maintainer use only.  No need for L10N.
    1.51      jio_print(warnbuf);
    1.52 -    FREE_C_HEAP_ARRAY(char, try_name);
    1.53 +    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
    1.54      try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
    1.55      jio_snprintf(warnbuf, sizeof(warnbuf),
    1.56                   "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
    1.57      jio_print(warnbuf);
    1.58      delete file;
    1.59 -    file = new(ResourceObj::C_HEAP) fileStream(try_name);
    1.60 -    FREE_C_HEAP_ARRAY(char, try_name);
    1.61 +    file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
    1.62 +    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
    1.63    }
    1.64    if (file->is_open()) {
    1.65      _log_file = file;
    1.66 -    xmlStream* xs = new(ResourceObj::C_HEAP) xmlStream(file);
    1.67 +    xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
    1.68      _outer_xmlStream = xs;
    1.69      if (this == tty)  xtty = xs;
    1.70      // Write XML header.
    1.71 @@ -815,7 +815,7 @@
    1.72  
    1.73  void ostream_init() {
    1.74    if (defaultStream::instance == NULL) {
    1.75 -    defaultStream::instance = new(ResourceObj::C_HEAP) defaultStream();
    1.76 +    defaultStream::instance = new(ResourceObj::C_HEAP, mtInternal) defaultStream();
    1.77      tty = defaultStream::instance;
    1.78  
    1.79      // We want to ensure that time stamps in GC logs consider time 0
    1.80 @@ -833,9 +833,9 @@
    1.81    gclog_or_tty = tty; // default to tty
    1.82    if (Arguments::gc_log_filename() != NULL) {
    1.83      fileStream * gclog  = UseGCLogFileRotation ?
    1.84 -                          new(ResourceObj::C_HEAP)
    1.85 +                          new(ResourceObj::C_HEAP, mtInternal)
    1.86                               rotatingFileStream(Arguments::gc_log_filename()) :
    1.87 -                          new(ResourceObj::C_HEAP)
    1.88 +                          new(ResourceObj::C_HEAP, mtInternal)
    1.89                               fileStream(Arguments::gc_log_filename());
    1.90      if (gclog->is_open()) {
    1.91        // now we update the time stamp of the GC log to be synced up
    1.92 @@ -940,7 +940,7 @@
    1.93  
    1.94  bufferedStream::bufferedStream(size_t initial_size, size_t bufmax) : outputStream() {
    1.95    buffer_length = initial_size;
    1.96 -  buffer        = NEW_C_HEAP_ARRAY(char, buffer_length);
    1.97 +  buffer        = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal);
    1.98    buffer_pos    = 0;
    1.99    buffer_fixed  = false;
   1.100    buffer_max    = bufmax;
   1.101 @@ -971,7 +971,7 @@
   1.102        if (end < buffer_length * 2) {
   1.103          end = buffer_length * 2;
   1.104        }
   1.105 -      buffer = REALLOC_C_HEAP_ARRAY(char, buffer, end);
   1.106 +      buffer = REALLOC_C_HEAP_ARRAY(char, buffer, end, mtInternal);
   1.107        buffer_length = end;
   1.108      }
   1.109    }
   1.110 @@ -989,7 +989,7 @@
   1.111  
   1.112  bufferedStream::~bufferedStream() {
   1.113    if (!buffer_fixed) {
   1.114 -    FREE_C_HEAP_ARRAY(char, buffer);
   1.115 +    FREE_C_HEAP_ARRAY(char, buffer, mtInternal);
   1.116    }
   1.117  }
   1.118  

mercurial