-
-
Notifications
You must be signed in to change notification settings - Fork 862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Outofmemoryerror occurred #1392
Comments
thank you for answer。 |
Upgrading to the latest version should solve the problem. :) |
I have upgraded to the latest version, but the memery consumption has been increasing。 |
It's normal for heap to increase with a high heap limit, as objects are created and destroyed, but garbage collection will kick in eventually. |
i use the following code, jvm args: -Xms200m -Xmx200m, although memery consumption has reached 600m, GC has not been recycled。 |
The
600m total memory for a 200m heap limit seems reasonable. This SO post indicates a 128m limit and 550m peak. Are you still getting OutOfMemory errors? |
but the memery consumption has been increasing。now has reached 1.2G |
please try the code: public static void main(String[] args) { |
Are you still getting OutOfMemory errors? |
have not throw OutOfMemoryErrors |
but the memery consumption has been increasing。 |
I can run that code with no problem. I use 2G heap and my memory peaks out at about 1.5 GiB. How are you measuring memory usage? |
using taskManager |
The JVM doesn't have a memory limit, and will use as much OS memory as is conveniently available for a variety of things to improve performance. You're seeing JVM memory being used, not your heap memory which is limited by If you run your program long enough, you'll see it level out. If you start up another program that needs memory, you might see it decrease. |
See this article for example. |
thank you answer |
I am using oshi to obtain the utilization rate of system resources. However, the following OutOfMemoryError has occurred frequently in the system recently.
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: GC overhead limit exceeded
By analyzing dumplog (using jhat java_pid8732.hprof ), it is found that there are a large number of oshi's instances, as follows:
Instance Counts for All Classes (excluding platform)
811603 instances of class oshi.util.platform.windows.PerfCounterQueryHandler
my code be excuted every second in the timer job:
List diskStores = hal.getDiskStores();
for (HWDiskStore disk : diskStores) {
List partitions = disk.getPartitions();
if (partitions == null) {
continue;
}
//获取系统盘和云雀安装盘的磁盘信息
for (HWPartition part : partitions) {
System.out.println(part.getMountPoint())
}
}
The text was updated successfully, but these errors were encountered: