8226879: Memory leak in Type::hashcons
authorthartmann
Fri, 28 Jun 2019 09:12:49 +0200
changeset 55519 c59f36ed7b52
parent 55518 73f1c84ca264
child 55520 33bb8c970770
child 57440 10f701a91883
8226879: Memory leak in Type::hashcons Summary: Call delete on xdual type. Reviewed-by: kvn
src/hotspot/share/opto/type.cpp
--- a/src/hotspot/share/opto/type.cpp	Thu Jun 27 22:03:19 2019 +0200
+++ b/src/hotspot/share/opto/type.cpp	Fri Jun 28 09:12:49 2019 +0200
@@ -730,8 +730,11 @@
   // Since we just discovered a new Type, compute its dual right now.
   assert( !_dual, "" );         // No dual yet
   _dual = xdual();              // Compute the dual
-  if( cmp(this,_dual)==0 ) {    // Handle self-symmetric
-    _dual = this;
+  if (cmp(this, _dual) == 0) {  // Handle self-symmetric
+    if (_dual != this) {
+      delete _dual;
+      _dual = this;
+    }
     return this;
   }
   assert( !_dual->_dual, "" );  // No reverse dual yet