[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
hi粉丝朋友们:
在android高版本编译时候经常会遇到framework一个相关任务编译时候经常把内存吃满:
//frameworks/base:system-api-stubs-docs-non-updatable metalava merged
导致oom即内存不足这种,那么怎么解决呢在不加内存条情况下
<>1、官方建议方法减少编译线程
22:42:20 ************************************************************
22:42:20 You are building on a machine with 15.5GB of RAM
22:42:20
22:42:20 The minimum required amount of free memory is around 16GB,
22:42:20 and even with that, some configurations may not work.
22:42:20
22:42:20 If you run into segfaults or other errors, try reducing your
22:42:20 -j value.
22:42:20 ************************************************************
所以这个时候你就把:make 变成 make -j 1 (-j
1代表只用一个线程编译,太慢了,所以一般是耗内存打的报错那个任务编译完成后,你再停止重新make 默认线程数)
<>2、增加swap内存,通过增加虚拟内存的方法扩大内存
swap是啥大家自己百度哈,大概就是用电脑硬盘当内存用
2.1、创建文件
dd if=/dev/zero of=/var/swap bs=1M count=10240
of:文件的保存路径
bs=1M count=10240:文件的大小为1MB*10240 = 10GB
创建的时间可能会久一点,大概一两分钟。
2.2、将文件格式化为swap文件
mkswap /var/swap
2.3、挂载swap文件
swapon /var/swap
这样,虚拟内存就扩充好了,可以通过命令查看服务器的内存情况:
free -m
系统重启,则需要重新挂载swap文件
想要永久:
vim /etc/fstab
最末尾加入如下:
/var/swap none swap sw 0 0