Java heap protection for debugging native methods

  • Authors:
  • Yuji Chiba

  • Affiliations:
  • Systems Development Laboratory, Hitachi, Ltd. 1099 Ozenji, Asao, Kawasaki, Kanagawa, Japan

  • Venue:
  • Science of Computer Programming
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Java virtual machine (JVM) crashes are often due to an invalid memory reference to the JVM heap. Before the bug that caused the invalid reference can be fixed, its location must be identified. It can be in either the JVM implementation or the native library written in C invoked from Java applications. To help system engineers identify the location, we implemented a feature using page protection that prevents threads executing native methods from referring to the JVM heap. This feature protects the JVM heap during native method execution; if the heap is referred to invalidly, it interrupts the execution by generating a page-fault exception. It then reports the location where the exception was generated. The runtime overhead for using this feature depends on the frequency of native method calls because the protection is switched on each time a native method is called. We evaluated the runtime overhead by running the SPECjvm98, SPECjbb2000, VolanoMark, and JFCMark benchmark suites on a PC with two Intel Xeon^(R) 1.6 GHz processors. The performance loss was less than 2% for the benchmark items that do not call native methods so frequently (~10^4 times per second) and 5%-20% for the benchmark items that do (10^4-10^5 times per second). The worst performance loss was 54%, which was recorded for a benchmark item that calls native methods 2.0x10^6 times per second.