java本機(jī)內(nèi)存分配Native?memory?allocation?mmap失敗問題解決
1. 報(bào)錯(cuò)
jenkins中啟動(dòng)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. 查看服務(wù)器內(nèi)存
[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權(quán)限下,創(chuàng)建swapfile
第一步:創(chuàng)建一個(gè)大小為500M的文件dd if=/dev/zero of=swapfile bs=1024 count=500000
4.2 將swapfile設(shè)置為swap空間
(第二步:把這個(gè)文件變成swap文件)mkswap swapfile
4.3 啟用交換空間,感同mount操作
swapon swapfile (刪除交換空間 swapoff swapfile)
以上就是java本機(jī)內(nèi)存分配Native memory allocation mmap失敗問題解決的詳細(xì)內(nèi)容,更多關(guān)于java本機(jī)內(nèi)存分配的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
深入淺析Spring Security5中默認(rèn)密碼編碼器
這篇文章主要介紹了Spring Security5中默認(rèn)密碼編碼器,非常不錯(cuò),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下2019-05-05
從@CrossOrigin到Gateway詳解Spring Boot跨域處理的10種姿勢
在前后端分離架構(gòu)成為主流的今天,跨域問題已成為每個(gè)Web開發(fā)者必須面對的挑戰(zhàn),本文將系統(tǒng)性地介紹10種Spring Boot跨域處理方案,下面小編就和大家簡單介紹一下吧2025-11-11
java使用xstream實(shí)現(xiàn)xml文件和對象之間的相互轉(zhuǎn)換
xml是一個(gè)用途比較廣泛的文件類型,在java里也自帶解析xml的包,但是本文使用的是xstream來實(shí)現(xiàn)xml和對象之間的相互轉(zhuǎn)換,xstream是一個(gè)第三方開源框架,使用起來比較方便,對java?xml和對象轉(zhuǎn)換相關(guān)知識感興趣的朋友一起看看吧2023-09-09
Spring?Boot整合Kafka+SSE實(shí)現(xiàn)實(shí)時(shí)數(shù)據(jù)展示
本文主要介紹了Spring?Boot整合Kafka+SSE實(shí)現(xiàn)實(shí)時(shí)數(shù)據(jù)展示2024-06-06

