users@jax-rpc.java.net

DataHandler OutOfMemory problem

From: Ian Jones <ijones_at_piper-group.com>
Date: Wed, 15 Dec 2004 11:15:29 -0000

Hi all,
 
I'm using a DataHandler to download a file from our server to a local
PC. This is working fine until the files get relatively large, e.g. I'm
currently attempting to transfer a zipped up file that is about 30Mb,
and then I the client reports an OutOfMemory error.
 
Here's a code snippet of the point in the code where the error is
occurring:
 
                                    logger.info("Requesting file");
                        
                        // ask for the file here
                        DataHandler dh = client.getFile(filePath);
                        
                        logger.info("Got data handler");
 
I get the first log message - "Requesting file" - and then the error. So
it is the retrieval of the DataHandler from the server, by calling
client.getFile() above, that is causing the error. The getFile() method
on the server simply does this:
 
    public DataHandler getFile(String filename) throws RemoteException {
        return new DataHandler(new FileDataSource(new File(filename)));
    }
 
I've increased the heap size of the java process running the client and
this stops the problem occurring. Is this the only way to stop this
happening? Or could I be doing something incorrectly to cause this
problem? I need to be able to deal with transferring files up to about
500Mb.
 
Any help will be greatly appreciated.
 
Ian Jones
Senior Analyst Developer
Piper Group plc
Email: ijones_at_piper-group.com
Tel: + 44 (0) 1454 284900
Fax: + 44 (0) 1454 284950
www.piper-group.com <http://www.piper-group.com/>
 
Information contained in this e-mail is intended for the use of the
addressee only, and is confidential and may be the subject of legal
professional privilege. Any dissemination, distribution, copying or use
of this communication without permission of the addressee is strictly
prohibited. The views expressed in this communication may not
necessarily be the views held by Piper Group plc.