gpt4 book ai didi

java - 在 Amazon EC2 t2.micro 实例上运行的 Jar 内存不足

转载 作者:行者123 更新时间:2023-12-02 03:53:12 34 4
gpt4 key购买 nike

我正在 Amazon 实例上通过 Java jar 运行一些 Web 应用程序,但它总是在 12 小时左右后耗尽内存。以下是写入文件的错误消息:

There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 12288 bytes for
committing reserved memory.
Possible reasons:
The system is out of physical RAM or swap space
In 32 bit mode, the process size limit was hit
Possible solutions:
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backi ng store is full
Use 64 bit Java on a 64 bit OS
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Set larger code cache with -XX:ReservedCodeCacheSize=
This output file may be truncated or incomplete.

Out of Memory Error (os_linux.cpp:2827), pid=5808, tid=140367928600320

JRE version: OpenJDK Runtime Environment (7.0_95) (build 1.7.0_95-b00)
Java VM: OpenJDK 64-Bit Server VM (24.95-b01 mixed mode linux-amd64 compressed oops)
Derivative: IcedTea 2.6.4
Distribution: Ubuntu 14.04.3 LTS, package 7u95-2.6.4-0ubuntu0.14.04.1
Failed to write core dump. Core dumps have been disabled.
To enable core dumping, try "ulimit -c unlimited" before starting Java again

我该如何继续?遵循他们的建议(例如增加堆大小或交换空间)是否有意义,或者我真的只需要将我的 EC2 实例升级到更大的大小?

最佳答案

问题是您用完了虚拟内存或实际地址空间。

这意味着您应该

  • 增加交换空间
  • 减小堆大小

需要减小堆大小的原因是为 JVM 和系统的其余部分留出更多内存

关于java - 在 Amazon EC2 t2.micro 实例上运行的 Jar 内存不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35705764/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com