Keeping oops

Tom Rodriguez Thomas.Rodriguez at Sun.COM
Tue Dec 11 13:45:12 PST 2007

> a) I need to create a HandleMark, somewhere really low in the stack - 
> say in the constructor of a thread or one of its first functions, and 
> have something like hashtable<handle, handle>

I don't think you could or should be able to get that to work that way. 
  If you want to use handles use JNI global handles.  See 
JNIHandles::make_global.  This is how the compilers keep long term 
references to objects.  Just remember that you have to explicitly delete 

> b) Keep pointers to oops (oop*) allocated, and pass them to the GC when 
> it comes by, like  hashtable<oop*, oop*>::oops_do(OopClosure* f) ? As 
> long as the oop* still points to that particular oop, it is not moved by 
> GC, right ?

You could do this but you have to do more work to plug it all in.  JNI 
global handles are probably the way to go.


> Which one of those is feasible / recommended ?
> Regards & sorry again
> Peter
> 2007/12/11, Peter Helfer < at 
> < at>>:
>     I'm having a hashtable, which should keep two oops 'grouped'
>     together. This

More information about the hotspot-runtime-dev mailing list