6728838: Native memory leak in StrikeCache.java
authorprr
Wed, 24 Dec 2008 09:53:52 -0800
changeset 2371 021228e73859
parent 2370 bdaf8cd4253f
child 2372 229b2c88d29c
6728838: Native memory leak in StrikeCache.java Reviewed-by: bae, igor
jdk/src/share/classes/sun/font/StrikeCache.java
--- a/jdk/src/share/classes/sun/font/StrikeCache.java	Thu Dec 18 11:25:09 2008 -0800
+++ b/jdk/src/share/classes/sun/font/StrikeCache.java	Wed Dec 24 09:53:52 2008 -0800
@@ -232,6 +232,16 @@
             if (disposer.pScalerContext != 0L) {
                 freeLongMemory(new long[0], disposer.pScalerContext);
             }
+        } else if (disposer.pScalerContext != 0L) {
+            /* Rarely a strike may have been created that never cached
+             * any glyphs. In this case we still want to free the scaler
+             * context.
+             */
+            if (FontManager.longAddresses) {
+                freeLongMemory(new long[0], disposer.pScalerContext);
+            } else {
+                freeIntMemory(new int[0], disposer.pScalerContext);
+            }
         }
     }