You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Chapoor Chapoor <ch...@gmail.com> on 2005/01/20 20:28:42 UTC
OutOfMemory in org.apache.axis.utils.ByteArrayOutputStream
Hi after tracing the Axis source code I can tell this:
When the AxisClient call the .invoke method I receive an OutOfMemory
exception (while the message I try to send is big one).
AxisClient.invoke() -> SimpleChain -> HTTPSender -> Message ->
SOAPPart -> ByteArray -> ByteArrayOutputStream.
The ByteArray's makeInputStream method calls the toByteArray in
ByteArrayOutputStream:
public synchronized byte toByteArray()[] {
int remaining = count;
int pos = 0;
byte newbuf[] = new byte[count]; <--- the problem!
for (int i = 0; i < buffers.size(); i++) {
byte[] buf = getBuffer(i);
int c = Math.min(buf.length, remaining);
System.arraycopy(buf, 0, newbuf, pos, c);
pos += c;
remaining -= c;
if (remaining == 0) {
break;
}
}
return newbuf;
}
The error raise when the byte newbuf[] = new byte[count]; is been
called. While the count is high?
I ve tried to increase the memory given to my application but the
problem is still there.
Please give me a work around for this!
Thanks.