diff -r 74533f63b116 -r d2a62e0f25eb src/os/bsd/vm/perfMemory_bsd.cpp --- a/src/os/bsd/vm/perfMemory_bsd.cpp Wed Jun 27 15:23:36 2012 +0200 +++ b/src/os/bsd/vm/perfMemory_bsd.cpp Thu Jun 28 17:03:16 2012 -0400 @@ -126,7 +126,7 @@ } } } - FREE_C_HEAP_ARRAY(char, destfile); + FREE_C_HEAP_ARRAY(char, destfile, mtInternal); } @@ -153,7 +153,7 @@ const char* tmpdir = os::get_temp_directory(); const char* perfdir = PERFDATA_NAME; size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3; - char* dirname = NEW_C_HEAP_ARRAY(char, nbytes); + char* dirname = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal); // construct the path name to user specific tmp directory snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user); @@ -246,7 +246,7 @@ if (bufsize == -1) bufsize = 1024; - char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize); + char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal); // POSIX interface to getpwuid_r is used on LINUX struct passwd* p; @@ -278,14 +278,14 @@ "pw_name zero length"); } } - FREE_C_HEAP_ARRAY(char, pwbuf); + FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); return NULL; } - char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1); + char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal); strcpy(user_name, p->pw_name); - FREE_C_HEAP_ARRAY(char, pwbuf); + FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); return user_name; } @@ -328,7 +328,7 @@ // to determine the user name for the process id. // struct dirent* dentry; - char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname)); + char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal); errno = 0; while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) { @@ -338,7 +338,7 @@ } char* usrdir_name = NEW_C_HEAP_ARRAY(char, - strlen(tmpdirname) + strlen(dentry->d_name) + 2); + strlen(tmpdirname) + strlen(dentry->d_name) + 2, mtInternal); strcpy(usrdir_name, tmpdirname); strcat(usrdir_name, "/"); strcat(usrdir_name, dentry->d_name); @@ -346,7 +346,7 @@ DIR* subdirp = os::opendir(usrdir_name); if (subdirp == NULL) { - FREE_C_HEAP_ARRAY(char, usrdir_name); + FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); continue; } @@ -357,13 +357,13 @@ // symlink can be exploited. // if (!is_directory_secure(usrdir_name)) { - FREE_C_HEAP_ARRAY(char, usrdir_name); + FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); os::closedir(subdirp); continue; } struct dirent* udentry; - char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name)); + char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal); errno = 0; while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) { @@ -372,7 +372,7 @@ int result; char* filename = NEW_C_HEAP_ARRAY(char, - strlen(usrdir_name) + strlen(udentry->d_name) + 2); + strlen(usrdir_name) + strlen(udentry->d_name) + 2, mtInternal); strcpy(filename, usrdir_name); strcat(filename, "/"); @@ -381,13 +381,13 @@ // don't follow symbolic links for the file RESTARTABLE(::lstat(filename, &statbuf), result); if (result == OS_ERR) { - FREE_C_HEAP_ARRAY(char, filename); + FREE_C_HEAP_ARRAY(char, filename, mtInternal); continue; } // skip over files that are not regular files. if (!S_ISREG(statbuf.st_mode)) { - FREE_C_HEAP_ARRAY(char, filename); + FREE_C_HEAP_ARRAY(char, filename, mtInternal); continue; } @@ -397,23 +397,23 @@ if (statbuf.st_ctime > oldest_ctime) { char* user = strchr(dentry->d_name, '_') + 1; - if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user); - oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1); + if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal); + oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal); strcpy(oldest_user, user); oldest_ctime = statbuf.st_ctime; } } - FREE_C_HEAP_ARRAY(char, filename); + FREE_C_HEAP_ARRAY(char, filename, mtInternal); } } os::closedir(subdirp); - FREE_C_HEAP_ARRAY(char, udbuf); - FREE_C_HEAP_ARRAY(char, usrdir_name); + FREE_C_HEAP_ARRAY(char, udbuf, mtInternal); + FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); } os::closedir(tmpdirp); - FREE_C_HEAP_ARRAY(char, tdbuf); + FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal); return(oldest_user); } @@ -434,7 +434,7 @@ // add 2 for the file separator and a null terminator. size_t nbytes = strlen(dirname) + UINT_CHARS + 2; - char* name = NEW_C_HEAP_ARRAY(char, nbytes); + char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal); snprintf(name, nbytes, "%s/%d", dirname, vmid); return name; @@ -472,7 +472,7 @@ static void remove_file(const char* dirname, const char* filename) { size_t nbytes = strlen(dirname) + strlen(filename) + 2; - char* path = NEW_C_HEAP_ARRAY(char, nbytes); + char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal); strcpy(path, dirname); strcat(path, "/"); @@ -480,7 +480,7 @@ remove_file(path); - FREE_C_HEAP_ARRAY(char, path); + FREE_C_HEAP_ARRAY(char, path, mtInternal); } @@ -517,7 +517,7 @@ // opendir/readdir. // struct dirent* entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname)); + char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal); errno = 0; while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) { @@ -556,7 +556,7 @@ errno = 0; } os::closedir(dirp); - FREE_C_HEAP_ARRAY(char, dbuf); + FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); } // make the user specific temporary directory. Returns true if @@ -723,11 +723,11 @@ fd = create_sharedmem_resources(dirname, filename, size); - FREE_C_HEAP_ARRAY(char, user_name); - FREE_C_HEAP_ARRAY(char, dirname); + FREE_C_HEAP_ARRAY(char, user_name, mtInternal); + FREE_C_HEAP_ARRAY(char, dirname, mtInternal); if (fd == -1) { - FREE_C_HEAP_ARRAY(char, filename); + FREE_C_HEAP_ARRAY(char, filename, mtInternal); return NULL; } @@ -743,7 +743,7 @@ warning("mmap failed - %s\n", strerror(errno)); } remove_file(filename); - FREE_C_HEAP_ARRAY(char, filename); + FREE_C_HEAP_ARRAY(char, filename, mtInternal); return NULL; } @@ -869,7 +869,7 @@ // store file, we don't follow them when attaching either. // if (!is_directory_secure(dirname)) { - FREE_C_HEAP_ARRAY(char, dirname); + FREE_C_HEAP_ARRAY(char, dirname, mtInternal); THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Process not found"); } @@ -884,9 +884,9 @@ strcpy(rfilename, filename); // free the c heap resources that are no longer needed - if (luser != user) FREE_C_HEAP_ARRAY(char, luser); - FREE_C_HEAP_ARRAY(char, dirname); - FREE_C_HEAP_ARRAY(char, filename); + if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); + FREE_C_HEAP_ARRAY(char, dirname, mtInternal); + FREE_C_HEAP_ARRAY(char, filename, mtInternal); // open the shared memory file for the give vmid fd = open_sharedmem_file(rfilename, file_flags, CHECK);