Ant报错之out of memory
用Ant打包一个比較大的项目的时候,遇到OutOfMemory的问题,求助于Google和百度,网上的解决方式非常多,可是个人认为不够具体全面。我的问题须要综合两种方法才解决。把方案记下来。以期帮助大众点滴。
错误类型
Ant编译任务报错OutOfMemoryError,提示信息显示是Java Heap Space。
解决方式
综合网上的两种方法,我的须要两个都用。分析一下,无非就是Java程序内存分配太小,不够用了。Java相应的调整參数为非标准參数-Xmx。
- 改动Ant命令脚本
找到Ant的安装文件夹,进入bin文件夹。依据不同的环境。改动相应的脚本。Linux以下,打开ant脚本, 在ant_exec_args=之前加一行代码export ANT_OPTS=-Xmx1024m;Windows以下打开ant.bat, 在@echo off之后加一行代码set ANT_OPTS=-Xmx1024m。 - 更改Ant的javac指令參数
新增下面參数fork="true" memoryMaximumSize="1024m"。注意fork="true"必须与memoryMaxinumSize 配套使用。fork="true"是指单独起一个java进程才处理编译任务。
总结
Java的内存不够错误。都是调整java命令參数。-Xmx调整堆的最大值,与java heap space错误相应;-XX:PermSize<=size>调整永久区的最大值,与java permanent space错误相应,比如-XX:PermSize=64m,把永久区调整为64M。
Ant报错之out of memory的更多相关文章
- 推送GitHub报错 fatal: Out of memory, malloc failed 解决办法
现象: 推送GitHub时,出现如下报错 fatal: Out of memory, malloc failed (tried to allocate XXXXXX bytes)error: fail ...
- git clone报错: Out of memory, malloc failed (tried to allocate 524288000 bytes)
IDEA 拉取项目报错:Out of memory, malloc failed (tried to allocate 524288000 bytes) 执行 git config --global ...
- nginx报错zero size shared memory zone one
为了限速,在虚拟主机中加上了一个参数:limit_conn one 1:结果导致重启nginx报错: zero size shared memory zone "one"解决办法是 ...
- tomcat启动报错There is insufficient memory for the Java Runtime Environment to continue
tomcat启动报错后显示以下错误 ## There is insufficient memory for the Java Runtime Environment to continue.# Nat ...
- Robotium ant 报错Unable to find instrumentation info for: ComponentInfo{project/android.test.InstrumentationTestRunner}
[echo] Running tests ... [exec] INSTRUMENTATION_STATUS: id=ActivityManagerService [exec] INSTRUMENTA ...
- 【转】eclipse运行 Ant报错Could not find the main class: org.eclipse.ant.internal.launching.remote.InternalAntRunner. Program
原文地址:http://blog.csdn.net/jiangtaoking/article/details/49151763 Could not find the main class: org.e ...
- 报错:out of memory java heap space
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决 ...
- git push的时候报错: Out of memory, malloc failed (tried to allocate 82037333 bytes)
原因:上传的文件过大,这里我上传的文件有10G+所以报了上面的错误 解决方法:依次运行:git config --global pack.threads 1 git,git config --glob ...
- 安装Php时候报错信息:virtual memory exhausted: Cannot allocate memory (不能分配内存)
原因是fileinfo这个函数在编译时非常消耗内存,而系统内存又不够了,所以才会出现此问题. 网上找了方法: 1,关闭其他占用大内存的进程. 2,在编译是添加参数 --disable-fileinfo
随机推荐
- Jquery 实现列表的显示和隐藏
本人github源码下载地址:https://github.com/liuyanpeng521/ListChange.git
- UVM基础之----uvm_object
uvm_void The uvm_void class is the base class for all UVM classes. uvm_object: The uvm_object class ...
- JS高级——Object.prototype成员
基本概念 成员 描述 Object.prototype.__proto__ 指向当对象被实例化的时候,用作原型的对象. Object.prototype.hasOwnProperty() 返回一个布尔 ...
- html5——表单
type类型 email //输入email格式 tel //手机号码 url //只能输入url格式 number //只能输入数字 search //搜索框 range //范围 滑动条 colo ...
- Java_Web三大框架之Hibernate 入门(一)
一.Hibernate简介: Hibernate作者——Gavin King Hibernate创始人 < Hibernate in action >作者 EJB 3.0的Entity b ...
- Django中图片的上传并显示
一.settings配置文件中配置 MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'medias').replace('\\', ...
- ubuntu下Fiddler抓包
参考 https://www.cnblogs.com/jcli/p/4474332.html https://www.jianshu.com/p/4505c732e378 1. 你要有个Mono环境, ...
- cocos creator destroy方法
node.destroy(),Node.destroyAllChildren并不会立即销毁,实际销毁操作会延迟到当前帧渲染前执行. 这段话可能不明白,但是在Node.destroyAllChildre ...
- 10.3 io流 正篇 FileReader FileWriter读写代码
一.FileWriter 小节: 1)FileWriter fw = new FileWriter("a.txt",true);//表示追加写入,默认是false.正常情况:执行多 ...
- EF入门
1.(安装EF)右键项目