Skip to Content.
Sympa Menu

mace-opensaml-users - SAMLResponse leak?

Subject: OpenSAML user discussion

List archive

SAMLResponse leak?


Chronological Thread 
  • From:
  • To:
  • Subject: SAMLResponse leak?
  • Date: Thu, 11 Aug 2005 12:44:55 -0400 (EDT)

Hi,
I think I have a memory leak problem when creating a SAMLResponse from a
signed assertion. I've made a short test program which just loops around the
SAMLResponse(InputStream, int) constructor. It seems to leak about 60kB each
time, and eventually hits OutOfMemory. What am I missing? Do I need to set
some properties for XML parser, or something?

I'm on a Win2000 with JDK 1.5.0_03.
In CLASSPATH: opensaml-1.1, log4j-1.2.9, commons-codec-1.3, xmlsec-20050514,
commons-logging-1.03.

Test program:
static final String assertionString = "<Response xmlns= ...";
public static void main(String[] args) {
try {
byte[] clearTextAssertion = assertionString.getBytes();
ByteArrayInputStream is = new
ByteArrayInputStream(clearTextAssertion);
for (int i = 0; i < 1000; ++i) {
SAMLResponse response = new SAMLResponse(is,1);
String recipient = response.getRecipient();
System.out.println(getMemInfo() + ", recipient = " + recipient +
", i = " + i);
is.reset();
System.gc();
}
} catch (SAMLException e) { e.printStackTrace(); }
}
private static String getMemInfo() {
Runtime rt = Runtime.getRuntime();
long heapSize = rt.totalMemory()/1000;
long heapUsed = heapSize-rt.freeMemory()/1000;
return "memory: used heap " + heapUsed +
" of " + heapSize + " kB ";
}

Best regards,
Per Fry kenvall



Archive powered by MHonArc 2.6.16.

Top of Page