changeset 1029:f68864fe53d3

6728838: Native memory leak in StrikeCache.java Reviewed-by: bae, igor
author prr
date Wed, 24 Dec 2008 09:53:52 -0800
parents feee56c07a8a
children 40ec164889bd
files src/share/classes/sun/font/StrikeCache.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/font/StrikeCache.java	Thu Dec 18 11:25:09 2008 -0800
+++ b/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);
+            }
         }
     }