You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Wei Lu <we...@cs.indiana.edu> on 2005/07/18 21:07:37 UTC
out of memory error
Just as the earilier thread mentioned, when sign a big file, the
xmlsecurity lib will throw the out of memory error. By looking the source
code, seems in XmlSignatureInput::updateOutputStream
InputStream is = getResetableInputStream();
if (bytes!=null) {
//already read write it, can be rea.
diOs.write(bytes,0,bytes.length);
return;
}
is.reset();
The plail file will be read into memory, and then caculcate the signature
over it. Obviously it leads to a big memory allocation. Not sure why this
big-allocation-for-all is used in here, for performance? After commenting
the above code out and add
InputStream is = this._inputOctetStreamProxy;
It works well, I want to make sure whether this modification will cause
other problems or not?
wei
Re: out of memory error
Posted by Raul Benito <ra...@gmail.com>.
Sadly your modification only works in a restricted scenario. Only one
reference to sign for inputstream. The getReseteableInputStream()
tries to do what you are doing, but it only works with
ByteArrayInputStreams, I have try to make it work with a
FileInputStreams but a entry in bugzilla stated my faillure.
But I welcome any new try.
Regards,
Raul
On 7/18/05, Wei Lu <we...@cs.indiana.edu> wrote:
>
> Just as the earilier thread mentioned, when sign a big file, the
> xmlsecurity lib will throw the out of memory error. By looking the source
> code, seems in XmlSignatureInput::updateOutputStream
>
> InputStream is = getResetableInputStream();
> if (bytes!=null) {
> //already read write it, can be rea.
> diOs.write(bytes,0,bytes.length);
> return;
> }
> is.reset();
>
> The plail file will be read into memory, and then caculcate the signature
> over it. Obviously it leads to a big memory allocation. Not sure why this
> big-allocation-for-all is used in here, for performance? After commenting
> the above code out and add
>
> InputStream is = this._inputOctetStreamProxy;
>
> It works well, I want to make sure whether this modification will cause
> other problems or not?
>
> wei
>
>
--
http://r-bg.com