Forum Discussion

nosterling's avatar
nosterling
Occasional Contributor
15 years ago

[RESOLVED]Example script, leaking memory

Hi, im a frequent user of SoapUI however im quite lousy at scripting.

However, im using one of the example scripts from this site looking like this

// get request property
def request = testRunner.testCase.getTestStepByName( "Request 1" );
def property = request.getProperty( "request" );

// parse out textnodes to modify
def node = new groovy.util.XmlParser(false,false).parseText(property.value);
def textNodes = node["soapenv:Body"]["sam:getContactInfo"]["String_1"][0].children()

// modify
textNodes.clear();
textNodes.add( "test" + System.currentTimeMillis() );

// write back to string
def writer = new java.io.StringWriter();
def printer = new groovy.util.XmlNodePrinter( new PrintWriter( writer ));
printer.print( node );

// set property
property.setValue( writer.toString() )



It seems though this is leaking memory somehow. Im running a load test with ONLY this script in this test just to ensure nothing else leaks, im running it with 100 threads and when it reaches the count ~1500 i get the error "java.lang.OutOfMemoryError: PermGen space"

I tried adding
printer.close ();

to the script right after

// write back to string
def writer = new java.io.StringWriter();
def printer = new groovy.util.XmlNodePrinter( new PrintWriter( writer ));
printer.print( node );

but it doesnt seem to work.


Anyone else have any ideas?

3 Replies