0

Before we get started because the answer seems obvious, the machine in question has the maximum heap space set to 8GB whereas other machines capable of running it have it at 1GB, so it's not a maximum heap size issue. Alright, let's dive in.

I'm doing a traffic simulation for a school project, and due to time constraints we did a lot of "quick and dirty" solutions that led to not optimizing our memory usage properly. Over the last two weeks we spent time profiling our program, identifying memory leaks, and reducing precision to get our overall memory overhead to around 500MB (according to JProfiler).

The problem is, only certain laptops are capable of running the simulation. My laptop (16GB RAM, i7 CPU) is not capable of running the sim. Of course, first thing I did was to increase my JVM's maximum heap space incrementally, getting all the way up to 8GB. The thing is, according to JProfiler we're maxing out at about 1GB memory after compilation and then dropping down to a steady 500MB throughout the sim.

All group members are running the same version of Java (9) and the same SDK version. We've even tried working in different versions of Java, to no avail. I'm working on the most recent version and have verified multiple times that we're running the exact same program with the exact same settings in the exact same environment yet for some reason only my computer has heap space issues.

Is there anyone who has any idea what might be wrong here? I've reinstalled JVM to no avail, and monitoring my computer during compilation I don't see more than around 2-3GB being used at any time, so I'm obviously not using all 8GB of the heap space I'm affording the virtual machine. There seems to be something seriously wrong, and any help would be greatly appreciated!

awrg
  • 31
  • 2
  • 2
    With no error message and no real information it's not much to go on. I'll suggest that the option you're using to increase heap space is the wrong option, and not being accepted by the JVM. – markspace May 29 '18 at 15:16
  • Does `-XX:+HeapDumpOnOutOfMemoryError` still work? [Try that](https://stackoverflow.com/questions/542979/using-heapdumponoutofmemoryerror-parameter-for-heap-dump-for-jboss). – Kayaman May 29 '18 at 15:20
  • Try running with `-XX:MaxPermSize=512m`. And don't set the heap too high unless it's really needed. The heap size should be optimal. – rustyx May 29 '18 at 15:20
  • 1
    I can imagine that problem can be related to some data that you use for the simulation. Probably a border value that cause a not correct deallocation of memory. – Davide Lorenzo MARINO May 29 '18 at 15:21
  • All things being equal (OS version, JVM version, data set, code, parameters...) if only 1 computer cannot run it, then it has to be the computer... Have you tried running it with JMX on, and attaching jconsole on it? You would see the behavior of the memory in heap *and* out of heap, the different generations, threads, ... – Nic3500 May 29 '18 at 15:31
  • Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.OutOfMemoryError: Java heap space at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:133) Caused by: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3210) at java.util.Arrays.copyOf(Arrays.java:3181) at java.util.ArrayList.grow(ArrayList.java:261) at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:235) at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:227) at java.util.ArrayList.add(ArrayList.java:458) – awrg May 29 '18 at 15:35
  • Didn't have room to add more, but when we're ensuring that there's still capacity in our arrayLists, I'm running out of space when calling a method "ensureCapacity()." Of course without the code you can't verify this, but considering that nobody else has this issue I'm certain it's not an issue with the code. – awrg May 29 '18 at 15:37

0 Answers0