Java Debugging Part 4: Memory Leaks

Memory leaks are something particulary hard to debug. You know when they occured, because your program crashed with the uncaught excpetion OutOfMemoryError, but finding out what caused it can be a nightmare without the proper tools. Automatic Heap Dumps By adding -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<file-or-dir-path> to your…

Debugging (Java)

As soon as your project reaches any scale and depth you need certain kinds of tools in order to continue. In this series I try to cover the tools and thier features that I have used most.…

Java Debugging Part 3: Heap Dumps and Heap analysis

A powerful last resort against bugs that dont reveal itself in testing, through logging or through stack dumps are heap dumps.…

Java Debugging Part 1: The Debugger

Introduction For this example we will use the debugger integrated in IntelliJ. In short a debugger allows you to stop the execution of your program once it hits a certain instruction/line of code, by setting a so called "breakpoint". When stopped the debugger then provides you with:…

Java Debugging Part 2: Stack Dumps

Simply by looking at the stacktrace a programmer can often figure out what went wrong. Stack dumps enable us to get the stacktraces of all the threads of a running program in real time…