引起:java.lang.OutOfMemoryError:Java堆空间 [英] Caused by: java.lang.OutOfMemoryError: Java heap space
问题描述
我的目标:
我想为1000位用户运行我的应用程序。
NOW
我正在尝试为100个用户运行。在应用程序运行期间,我想为每个用户执行一些过程,每个用户至少需要一个小时,所以我每个用户使用一个线程。
错误
引起:java.lang.OutOfMemoryError:Java堆空间
我试图找出这意味着什么,但我不确定如何解决它。
有人可以帮帮我吗?
这个错误意味着你的程序需要的内存比JVM允许的内存多! / p>
因此你几乎有两个选择:
- 增加程序的默认记忆允许使用
-Xmx
选项(例如1024 MB:-Xmx1024m
) - 修改程序,使其占用更少的内存,使用较少的大数据结构,并删除程序中某些时候不再使用的对象
正如Peter Lawrey指出的那样,使用剖析器来查看你的程序在这种情况下做了什么通常是一个好主意。
MY GOAL:
I want run my application for 1000 users.
NOW
I am trying to run for 100 user. During application run, I'd like to do some process for each user that will take a minimum of one hour per user, so I'm using one thread per user.
ERROR
Caused by: java.lang.OutOfMemoryError: Java heap space
I've tried to figure out what this means, but I'm not really sure how to resolve it.
Can anybody help me?
This error means that your program needs more memory than your JVM allowed it to use!
Therefore you pretty much have two options:
- Increase the default memory your program is allowed to use using the
-Xmx
option (for instance for 1024 MB:-Xmx1024m
) - Modify your program so that it needs less memory, using less big data structures and getting rid of objects that are not any more used at some point in your program
As Peter Lawrey pointed out, using a profiler to see what your program is doing in such situations is generally a good idea.
这篇关于引起:java.lang.OutOfMemoryError:Java堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!