oop, Handle, and hash key

Peng Du imdupeng at gmail.com
Mon Mar 1 12:18:26 PST 2010


I need unique and persistent identifiers to Java objects as keys to a
hash table. However, I couldn't find an object_id kind routine. And I am
not sure if identity_hash() guarantees uniqueness. So, I figured I can
use the address of a Handle of an oop for this purpose, e.g. 

oop o;
Handle h(o);
hash.put(h->raw_value(), xx);

Considering there is no HandleMark around the code, does this work? If
yes, would GC reclaim the handle if the associated object (oop) dies? 


More information about the hotspot-dev mailing list