Java Profiler Knowledge Base
Troubleshooting: working with the profiler
I get an OutOfMemoryError working with the profiler UICan't find your answer? Please refer to documentation and demos, ask your question in forum, or contact support.
The profiler UI may run out of memory, e.g. while opening huge snapshots. "Huge" usually means around 1 Gb, but the exact numbers vary in each particular case, depending on snapshot specifics. When this happens, you get the corresponding error message.
This is mostly a problem when you run the profiler UI on a 32-bit system.
The best solution is to run the profiler UI on a 64-bit system:
- 64-bit systems do not have the 2-4 Gb memory size limitation of 32-bit systems. Snapshot of virtually any size can be successfully loaded and analyzed if there is enough physical memory.
- Running the profiler UI on a 64-bit system doesn't require you to change the environment where your profiled applications run. So if your profiled applications run on a 32-bit system and you cannot or do not want to change this, then you don't have to. It only matters that the profiler UI itself runs on 64-bit system; it will let you analyze results gathered on either 32 or 64-bit machines.
- You can get an "Out of memory error" on a 64-bit system, too. This may happen because the default heap size limit for the profiler UI (512M) is not enough in some cases. If this happens, simply change the -Xmx to a bigger value, as suggested in the error message. Usually, 64-bit systems have enough physical and virtual memory, so the problem should be solved. Note: even if the system is 64-bit, it can contain both 32 and 64-bit JVMs. Please make sure you use the appropriate one (e.g. make the corresponding change in yjp.sh).
If you cannot use a 64-bit system, there are workarounds that may help you load huge snapshots on a 32-bit system.
-
Try tweaking the -Xmx value.
The profiler UI is a Java program and stores its data in the Java heap. In addition, for efficiency, some parts of a snapshot file are also mapped directly to the virtual memory outside the Java heap.
Thus Java heap (limit controlled by -Xmx) and the memory outside it (the rest of the memory available for the process) are competitors on a 32-bit system and together must not exceed its 2-4 Gb virtual memory limit.
If you make -Xmx too big or too small, the snapshot may not fit.
So, please pay attention to what error message you get:
- If you get "Out of memory" error, please increase the -Xmx value to make the Java heap bigger
- If you get "Not enough virtual memory", please decrease the -Xmx value to make the Java heap smaller
Once again, you wouldn't need to do such tweaking running the profiler UI on a 64-bit system, as described above.
Depending on your OS, find the -Xmx setting in:
-
Windows:
- Since version 9.0:
<Profiler Installation Directory>\bin\yjp.ini - In older versions:
<Profiler Installation Directory>\bin\win32\yjp.ini
- Since version 9.0:
-
Mac OS X:
<Profiler Installation Directory>/Contents/Info.plist -
other platforms:
<Profiler Installation Directory>/bin/yjp.sh
Don't forget to restart the profiler after changing -Xmx
- Try to make snapshots smaller by running the profiled application with a smaller Java heap limit (-Xmx setting of the profiled application). If the profiled application has a smaller heap, then the resulting snapshots will in general be smaller in size, will take less memory to load, and will allow faster analysis in the UI. Usually it's OK to run profiled applications with smaller heaps in order to perform performance analysis; optimizations based on such profiling will still be relevant when the same application runs with a bigger heap (e.g. in production).