there are 2 solutions:
1、in linux server, edit
ant:
java -Xms128m -Xmx256m -classpath "%ANTCLASSPATH%" org.apache.tools.ant.Main %ANT_ARGS%
ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"
change to
ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS
-Xms128m -Xmx512m -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"
2、when you run ant in eclipse, configure parameter follow as:
in build.xml
right-hand button->Run as->Extenal Tools Configurations->JRE Vmargument add
-Xms128m -Xmx512m there, you can solve this problem.