Hi folks,

sorry for the off-topic question but I was bitten by a generic Java
issue and I thought there might be a couple of experts out there.

I tried to use FileChannel.transferTo() to copy large files efficiently.
Now the common way to use this is

inChannel.transferTo(0, inChannel.size(), outChannel);

(I know that the number of bytes actually written may differ from the
number of bytes requested so this would need a loop.)

I found however that for counts bigger than 2GB (count is declared
long), we get an OutOfMemory exception "Map failed" (Sun 32bit-JVM 1.5,
Linux). Obviously, the JVM tries to use a memory-mapped file to do the
copying and the address space is too small.

Searching the net gave me some closed issues in the Sun bug database
which basically told me that this should have been fixed long ago. Other
than that, the problem seems to be widely undocumented/unknown.

Could some kind soul please confirm that this error is supposed to
happen (If not, please give JVM-version and OS)? Shouldn't this be
handled by the JVM transparently? Anyone knowing an elegant workaround
other than copying in small chunks?

Your experiences are appreciated.

Thanks for replying.

Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to