Minor memory issues in fastdebug build

Jeremy Manson jeremymanson at google.com
Wed Dec 12 16:11:23 PST 2012


Hi folks,

I was playing with the fastdebug build, and I found a couple of
trivial memory issues.  A patch follows: let me know if you want me to
do some footwork to correct it (file a bug, etc).

Jeremy

diff -r 121aa71316af src/share/vm/runtime/vmStructs.cpp
--- a/src/share/vm/runtime/vmStructs.cpp        Fri Dec 07 10:46:54 2012 -0800
+++ b/src/share/vm/runtime/vmStructs.cpp        Wed Dec 12 16:05:25 2012 -0800
@@ -3146,10 +3146,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      delete s;
+      delete [] s;
       return 1;
     }
-    delete s;
+    delete [] s;
   }
   const char* start = NULL;
   if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3165,10 +3165,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      delete s;
+      delete [] s;
       return 1;
     }
-    delete s;
+    delete [] s;
   }
   if (strstr(typeName, "const ") == typeName) {
     const char * s = typeName + strlen("const ");
@@ -3182,8 +3182,10 @@
     s[len - 6] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
+      free(s);
       return 1;
     }
+    free(s);
   }
   if (!isRecurse) {
     tty->print_cr("type \"%s\" not found", typeName);


More information about the hotspot-runtime-dev mailing list