Monday, September 26, 2011

Java, GC - object layout thoughts

Just some very draft thoughts - would it be possible to approach some of well-known GC-related memory problems by simply separating structure and data? What I mean is navigational links of an object, i.e. references to other objects, can be kept aside of the flat data associated with the object. In that case structural part of all objects will constitute a smaller memory region compared to the one created by how it is done currently. This may probably improve the efficiency of GC since the collector would need to scan smaller memory spaces with closer reference locality.
The data region would likely need lighter collection algorithms than it currently does. However, a certain side-effect of the approach is that the run-time would have to do an extra navigation every time when a reference has to be resolved into the corresponding data.
UPD 2012-07-16 Here is another experimentally-proven approach which relies on separating of pointer and data values at a finer grain. The key idea is again in that the pointer-data separation allows for building very efficient garbage collection algorithms.