Index: trunk/src/com/kitfox/svg/SVGElement.java
===================================================================
--- trunk/src/com/kitfox/svg/SVGElement.java	(revision 15904)
+++ trunk/src/com/kitfox/svg/SVGElement.java	(revision 15912)
@@ -47,4 +47,5 @@
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
@@ -89,10 +90,10 @@
      * Styles defined for this elemnt via the <b>style</b> attribute.
      */
-    protected final HashMap<String, String> inlineStyles = new HashMap<>();
+    private Map<String, String> inlineStyles = Collections.emptyMap();
     /**
      * Presentation attributes set for this element. Ie, any attribute other
      * than the <b>style</b> attribute.
      */
-    protected final HashMap<String, String> presAttributes = new HashMap<>();
+    private Map<String, String> presAttributes = Collections.emptyMap();
     /**
      * A list of presentation attributes to not include in the presentation
@@ -273,5 +274,5 @@
         if (style != null)
         {
-            XMLParseUtil.parseStyle(style, inlineStyles);
+            inlineStyles = XMLParseUtil.parseStyle(style);
         }
 
@@ -299,6 +300,11 @@
             String value = attrs.getValue(i);
 
+            if (i == 0)
+            {
+                presAttributes = new HashMap<>();
+            }
             presAttributes.put(name, value == null ? null : value.intern());
         }
+        presAttributes = XMLParseUtil.toUnmodifiableMap(presAttributes);
     }
 
Index: trunk/src/com/kitfox/svg/xml/XMLParseUtil.java
===================================================================
--- trunk/src/com/kitfox/svg/xml/XMLParseUtil.java	(revision 15904)
+++ trunk/src/com/kitfox/svg/xml/XMLParseUtil.java	(revision 15912)
@@ -38,7 +38,10 @@
 
 import java.awt.Toolkit;
+import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -58,4 +61,17 @@
     static final Matcher quoteMatch = Pattern.compile("^'|'$").matcher("");
 
+    /**
+     * A reference to {@link Map#ofEntries(Map.Entry[])} available since Java 9
+     */
+    static final Method mapOfEntries = mapOfEntriesMethod();
+
+    private static Method mapOfEntriesMethod() {
+        try {
+            return Map.class.getMethod("ofEntries", Map.Entry[].class);
+        } catch (NoSuchMethodException e) {
+            return null;
+        }
+    }
+
     /** Creates a new instance of XMLParseUtil */
     private XMLParseUtil()
@@ -300,7 +316,8 @@
      * @param styleString - A CSS formatted string of styles.  Eg,
      *     "font-size:12;fill:#d32c27;fill-rule:evenodd;stroke-width:1pt;"
-     * @param map - A map to which these styles will be added
-     */
-    public static void parseStyle(String styleString, HashMap<String, String> map) {
+     * @return the map with the added styles
+     */
+    public static Map<String, String> parseStyle(String styleString) {
+        final Map<String, String> map = new HashMap<>();
         final Pattern patSemi = Pattern.compile(";");
 
@@ -315,4 +332,34 @@
                     map.put(key, value);
                 });
-    }
+        return toUnmodifiableMap(map);
+    }
+
+    /**
+     * Returns an unmodifiable map for the given map.
+     * Makes use of {@link Collections#emptyMap()} and {@link Collections#singletonMap} and {@link Map#ofEntries(Map.Entry[])} to save memory.
+     *
+     * @param map the map for which an unmodifiable map is to be returned
+     * @param <K> the type of keys maintained by this map
+     * @param <V> the type of mapped values
+     * @return an unmodifiable map
+     * @see <a href="https://dzone.com/articles/preventing-your-java-collections-from-wasting-memo">
+     * How to Prevent Your Java Collections From Wasting Memory</a>
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V> Map<K, V> toUnmodifiableMap(Map<K, V> map) {
+        if (map == null || map.isEmpty()) {
+            return Collections.emptyMap();
+        } else if (map.size() == 1) {
+            final Map.Entry<K, V> entry = map.entrySet().iterator().next();
+            return Collections.singletonMap(entry.getKey(), entry.getValue());
+        } else if (mapOfEntries != null) {
+            try {
+                // Java 9: use Map.ofEntries(...)
+                return (Map<K, V>) mapOfEntries.invoke(null, new Object[]{map.entrySet().toArray(new Map.Entry[0])});
+            } catch (Exception ignore) {
+            }
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
 }
