java本机内存分配Native memory allocation mmap失败问题解决
更新时间:2023年11月03日 09:18:13 作者:丰木
这篇文章主要介绍了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本机内存分配的资料请关注脚本之家其它相关文章!
相关文章
从@CrossOrigin到Gateway详解Spring Boot跨域处理的10种姿势
在前后端分离架构成为主流的今天,跨域问题已成为每个Web开发者必须面对的挑战,本文将系统性地介绍10种Spring Boot跨域处理方案,下面小编就和大家简单介绍一下吧2025-11-11
java使用xstream实现xml文件和对象之间的相互转换
xml是一个用途比较广泛的文件类型,在java里也自带解析xml的包,但是本文使用的是xstream来实现xml和对象之间的相互转换,xstream是一个第三方开源框架,使用起来比较方便,对java xml和对象转换相关知识感兴趣的朋友一起看看吧2023-09-09
Spring Boot整合Kafka+SSE实现实时数据展示
本文主要介绍了Spring Boot整合Kafka+SSE实现实时数据展示2024-06-06


最新评论