Contributor
Varun Garg

Eclipse OMR: Teach memcheck which regions of memory are accessible


Mentors
Andrew Young
Organization
The Eclipse Foundation

Garbage collector does the job of allocating the objects in memory heap, checking them if they are alive i.e., if they are referenced from any other alive object and finally removing them if they are no longer alive. Valgrind is a memory checking tool that detects memory problems such as leaks. However, it is unable to understand which areas of our JVM memory are accessible (such as identify user space). My goal is to teach it which regions are available thereby detecting memory issues more accurately.

This is done by using memcheck API to tell memcheck about allocated memory pool, inform it when new regions are added and destroyed and inform it of individual objects created and destroyed in the those regions (in the pool). Garbage collector also doesn't track individual objects that memcheck needs to know while freeing, and this project also solves that problem by storing them globally on allocation and removing them on free. This is implemented across all GC schemes in OMR.

Code: https://github.com/eclipse/omr/pull/1311/

Docs: https://github.com/eclipse/omr/blob/master/doc/Valgrind%20Memcheck%20API.md

Header: https://github.com/eclipse/omr/blob/master/gc/base/MemcheckWrapper.hpp