java本机内存分配Native memory allocation mmap失败问题解决
作者:丰木
这篇文章主要介绍了java本机内存分配Native memory allocation mmap失败问题解决,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
1. 报错
jenkins中启动java的jar包起不来, 最终原因是没有swap空间。
> OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000795380000, 591396864, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 591396864 bytes for committing reserved memory. # An error report file with more information is saved as: # /tmp/hs_err_pid23.log
2. 查看服务器内存
[root@me opt]# free -m
              total        used        free      shared  buff/cache   available
Mem:          31490       28715        2018           9         756        2380
Swap:             0           0           0
[root@me opt]# free -g
              total        used        free      shared  buff/cache   available
Mem:             30          28           1           0           0           2
Swap:             0           0           03. 操作
[root@me opt]# dd if=/dev/zero of=swapfile bs=1024 count=500000
500000+0 records in
500000+0 records out
512000000 bytes (512 MB) copied, 1.41014 s, 363 MB/s
[root@me opt]# mkswap swapfile
Setting up swapspace version 1, size = 499996 KiB
no label, UUID=6f2e755d-d294-4f4c-8671-d965ae9d15e5
[root@soin opt]# swapon swapfile
swapon: /opt/swapfile: insecure permissions 0644, 0600 suggested.
[root@me opt]# free -h
              total        used        free      shared  buff/cache   available
Mem:            30G         28G        1.4G        9.1M        1.3G        2.3G
Swap:          488M          0B        488M4. 解释说明:
4.1 root权限下,创建swapfile
第一步:创建一个大小为500M的文件dd if=/dev/zero of=swapfile bs=1024 count=500000
4.2 将swapfile设置为swap空间
(第二步:把这个文件变成swap文件)mkswap swapfile
4.3 启用交换空间,感同mount操作
swapon swapfile (删除交换空间 swapoff swapfile)
以上就是java本机内存分配Native memory allocation mmap失败问题解决的详细内容,更多关于java本机内存分配的资料请关注脚本之家其它相关文章!
