Reverting revision 922179 of ResourceUtils.java resolves the 1.8.1 regression.
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/an t/util/ResourceUtils.java?r1=908356&r2=922179&diff_format=h problem 48894 1) buffer size management is present in FileChannel, so we do not need to impose any limit. 2) bus error in gij when requested copy size > remaining file size (this is a bug in gij that will not be triggered anymore by ant from this line) From: Murray, Mike Sent: Thursday, May 20, 2010 7:14 PM To: [email protected] Subject: 1.8.1 OutOfMemoryError: Map failed Some 1.8.1 change is causing copies of large files to fail when max heap is set to a "high" value. I got the error below with -Xmx800M. I lowered it to 750 and it worked. The file being copied is 840M. A file of 670M failed with -Xmx900M, but succeeded with 800. It runs for 2 seconds and fails as soon as this task is called. Java VisualVM shows the process uses less than 20M. <copy file="my.zip" tofile="my.01.zip" /> Apparently the copy now needs to allocate memory, based on the size of the file, and there isn't enough, goodnight. Any idea what changed? It's using Java 1.6 on 32-bit Windows XP. Thanks, Mike BUILD FAILED Failed to copy my.zip to my.01.zip due to Map failed at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:853) at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:523) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1 06) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397) at org.apache.tools.ant.Project.executeTarget(Project.java:1366) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut or.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1249) at org.apache.tools.ant.Main.runBuild(Main.java:801) at org.apache.tools.ant.Main.startAnt(Main.java:218) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: java.io.IOException: Map failed at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:761) at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java :450) at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:523) at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java: 475) at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:519) at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:481) at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:310) at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:841) ... 17 more Caused by: java.lang.OutOfMemoryError: Map failed at sun.nio.ch.FileChannelImpl.map0(Native Method) at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:758) ... 24 more
