<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">My application creates and executes big finite automata, which are so costly to construct that it is worth caching them for reuse.  Thus they are likely to persist thru gc cycles.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">My automata consist of arrays of ints, arrays of objects, and various small objects of different class types.  What strategies can I take to ensure
 that these are co-located on the heap to avoid L1/L2 cache misses during automata execution?  If I succeed in this, how can I be confident that they will still be co-located AFTER gc compaction?</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">One idea is to have the cache hold a wrapper object rather than the graph reference itself.  The wrapper object would hold references to all the individual components of the graph, as well as the graph.  Would this help the gc cycle continue to co-locate the element objects of the graph?</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent;
 font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Andy</div></div></body></html>