Package hudson.util

Class HeapSpaceStringConverter

  • All Implemented Interfaces:
    com.thoughtworks.xstream.converters.ConverterMatcher, com.thoughtworks.xstream.converters.SingleValueConverter

    public class HeapSpaceStringConverter
    extends com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
    Up to XStream 1.3 the default StringConverter in XStream used String.intern(), which stressed the (rather limited) PermGen space with a large XML file. Since XStream 1.3 it use a WeakHashMap cache to always use the same String instances, but this has also major problems with a single long living XStream instance (as we have in Jenkins) See XSTR-604.

    Use this to avoid that (instead those strings will now be allocated to the heap space.)

    Kohsuke Kawaguchi
    • Constructor Detail

      • HeapSpaceStringConverter

        public HeapSpaceStringConverter()
    • Method Detail

      • canConvert

        public boolean canConvert​(Class type)
        Specified by:
        canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
        Specified by:
        canConvert in class com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
      • fromString

        public Object fromString​(String str)
        Specified by:
        fromString in interface com.thoughtworks.xstream.converters.SingleValueConverter
        Specified by:
        fromString in class com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter