Arvin
Arvin

Reputation: 325

OpenJDK: Modifying Java Heap Management

The project that I'm working on is about modification of OpenJdk heap management and garbage collection systems. Currently my main concern is to find the code segments that are responsible for allocating space in heap when a new object is created.

I was wondering if any Java experts can tell me where to start searching.

Any feedback of yours will be greatly appreciated.

Upvotes: 1

Views: 177

Answers (2)

Markus Weninger
Markus Weninger

Reputation: 12638

It also depends on which garbage collector you want to instrument. I recently worked on the garbage first (G1) GC, whichs main class is located in /share/vm/gc_implementation/g1/g1CollectedHeap.

You may also want to have a look at our research project AntTracks, which consits of a customized JVM that tracks each object allocation and movement within the JVM and logs it to a trace file which then can be analyzed. Therefore, we also had to instrument each location where the GC allocates an object.

Upvotes: 1

wero
wero

Reputation: 32980

Method InstanceKlass::allocate_instance might be a good entry point for your research. It is calling CollectedHeap::obj_allocate.

http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/oops/instanceKlass.cpp#l1096

Upvotes: 2

Related Questions