Problem Description:
Transformerfactory tfactory = transformerfactory. Newinstance ();
Transformer Transformer = Tfactory.newtransformer (new Streamsource (InputStream));
Transformer.transform (Xmlsource, outputtarget)//crash here
Crash,crash file summary when calling Transformer transform XSLT file to XML file in Java code:
HEAP
def New Generation total 314560K, used 5786K [0x04600000, 0x19b50000, 0x19b50000]
Eden Space 279616k,< c4/>2% used [0x04600000, 0x04ba6b80, 0x15710000)
from Space 34944K, 0% used [0x15710000, 0x15710000, 0x17930000] to Spaces 34944K, 0% used [0x17930000, 0x17930000, 0x19b50000)
tenured generation total 699072K , used 48833K [0x19b50000, 0x44600000, 0x44600000) The space
699072K, 6% used [0x19b50000, 0x1cb005f0, 0x1cb006 0x44600000)
Compacting Perm Gen Total 86272K, used 86136K [0x44600000, 0x49a40000, 0x64600000]
Space 86272K, 99% used [0x44600000, 0x49a1e2f8, 0x49a1e400, 0x49a40000)
No shared spaces configured.
Log shows Perm Gen space is not enough, transform XSLT does need to load a large number of DLL files, the most solution on the network is to increase the JVM parameter MaxPermSize value:
-xx:maxpermsize=512m
Following this method to gradually increase the number of values has been crash, and found an interesting phenomenon:
Compacting Perm Gen Total 86272K,
This value has not changed, why? Heap large enough, the JVM has not had time to increase Perm Gen is dead? The JVM parameter is then added directly to initialize:
-xx:permsize=512m
As a result the problem is solved, it seems that this is the JVM's bug and there is an empty test JRE7.
Vm_info:java HotSpot (TM) Client VM (20.4-B02) for windows-x86 JRE (1.6.0_29-B11),
built on OCT 3 01:01:08 by "Java_re" with MS VC + + 7.1 (VS2003)