This forum has been archived. Please start a new discussion on GitHub.

Transfer Files with ICE


I'm trying to send files over network with ICE in Java.
I've defined an interface to send a file as byte-array and I'm wondering how to optimize memory usage of my program.

As far as i observed, there is a maxMessageSize property, which i set to e.g. 50MB.

If I send e.g. a file with 50 MB with ICE, I guess memory consumption of my program() increase fastly, especially when i use multithreading. Also I observed that, e.g. between two successive method invocation at the receiver the garbage collector of Java does not free the memory.

what is the best/recommended way to transfer 'large' files with ICE?

Regards Klaus


  • benoit
    benoit Rennes, France

    Hi Klaus,

    As you discovered, transferring large amounts of data with a single invocation can end up consuming large amounts of memory. To reduce this memory consumption, you'll need to send the file in several chunks of equal size (it could be 512KB, 1MB chunks, ...). This will ensure that each thread consumes a fixed amount of memory instead of depending on the file size. This does require the client & server to keep state on the current file transfer.


  • Hi Benoit,

    thanks for your message.

    with ~ 1MB chunks, memory consumption is much lower.

    Regards Klaus