Minor memory issues in fastdebug build

David Holmes david.holmes at oracle.com
Wed Jan 9 01:52:31 PST 2013


Jeremy,

I didn't see any follow up on this, nor do I see a bug, so I created 
8005921: Memory leaks in vmStructs.cpp

These fixes look fine to me.

I know Mikael is in the process of doing some vmStructs changes at the 
moment so perhaps I can put him on the spot and see if he could sponsor 
this at the same time.

Thanks,
David

On 13/12/2012 10:11 AM, Jeremy Manson wrote:
> 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