You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Hideki Kohno <ko...@ns-sol.co.jp> on 2001/11/28 13:28:54 UTC

File Attachment Trouble

Hello.

I have File Attachment Troube.
I made a SOAP Client and SOAP Servre(TOMCAT) using Apache-SOAP.
To upload many file to SOAP Server, it create DataSouce many times

After 10 times looped, I got "Out of Memory".

Please teach me how to release memory(ByteArray or Byte).



Following is a part of my source code.

for(int i=0; i<100;i++) {
    DataSource ds1 = new ByteArrayDataSource(new
java.io.File("e:\\john.tif"), null);
    DataHandler dh1 = new DataHandler(ds1);
    DataSource ds2 = new ByteArrayDataSource(new
java.io.File("e:\\john.bmp"), null);
    DataHandler dh2 = new DataHandler(ds2);
    files.add(dh1);
    files.add(dh2);
    Parameter dataParam12 = new Parameter("files", Vector.class, files,
null);

    params.addElement(dataParam1);

......

call soap server
}



Re: File Attachment Trouble

Posted by Hideki Kohno <ko...@ns-sol.co.jp>.
I found a memory lead bug.

I RE-Use Call object.(I changed parameters and method name).
So, byte[] were remained in memory.

> Hello.
> 
> I have File Attachment Troube.
> I made a SOAP Client and SOAP Servre(TOMCAT) using Apache-SOAP.
> To upload many file to SOAP Server, it create DataSouce many times
> 
> After 10 times looped, I got "Out of Memory".
> 
> Please teach me how to release memory(ByteArray or Byte).
> 
> 
> 
> Following is a part of my source code.
> 
> for(int i=0; i<100;i++) {
>     DataSource ds1 = new ByteArrayDataSource(new
> java.io.File("e:\\john.tif"), null);
>     DataHandler dh1 = new DataHandler(ds1);
>     DataSource ds2 = new ByteArrayDataSource(new
> java.io.File("e:\\john.bmp"), null);
>     DataHandler dh2 = new DataHandler(ds2);
>     files.add(dh1);
>     files.add(dh2);
>     Parameter dataParam12 = new Parameter("files", Vector.class, files,
> null);
> 
>     params.addElement(dataParam1);
> 
> ......
> 
> call soap server
> }
> 
> 


Re: File Attachment Trouble

Posted by Hideki Kohno <ko...@ns-sol.co.jp>.
I found a memory lead bug.

I RE-Use Call object.(I changed parameters and method name).
So, byte[] were remained in memory.

> Hello.
> 
> I have File Attachment Troube.
> I made a SOAP Client and SOAP Servre(TOMCAT) using Apache-SOAP.
> To upload many file to SOAP Server, it create DataSouce many times
> 
> After 10 times looped, I got "Out of Memory".
> 
> Please teach me how to release memory(ByteArray or Byte).
> 
> 
> 
> Following is a part of my source code.
> 
> for(int i=0; i<100;i++) {
>     DataSource ds1 = new ByteArrayDataSource(new
> java.io.File("e:\\john.tif"), null);
>     DataHandler dh1 = new DataHandler(ds1);
>     DataSource ds2 = new ByteArrayDataSource(new
> java.io.File("e:\\john.bmp"), null);
>     DataHandler dh2 = new DataHandler(ds2);
>     files.add(dh1);
>     files.add(dh2);
>     Parameter dataParam12 = new Parameter("files", Vector.class, files,
> null);
> 
>     params.addElement(dataParam1);
> 
> ......
> 
> call soap server
> }
> 
>