When will object change its native memory address?

David Holmes david.holmes at oracle.com
Mon Apr 23 18:45:40 PDT 2012


On 23/04/2012 11:21 PM, Crazy Java wrote:
> I am working on a project of visualizing the HotSpot Heap (similar to
> GCSpy). The last thing I need is to be able to determine when any object
> changes its native memory address. I know this is low level and VM
> specific, but I need that information for HotSpot case.
>
> I was searching the JLS and JVM spec but I didn't found an answer for my

Object addressing is an implementation artifact and so has no mention in 
either the VM or language spec.

> question: When will object change is native memory address? It is clear
> that as part of GC (especially copying algorithms) that could happen.
> That's fine. But, are there any other circumstances when an object could
> change its address? If there are when and why? I assume that HotSpot
> should not move objects in memory except GC, but I have to be sure
> because I didn't want to introduce indeterminism in my application.

I'm fairly sure that in Hotspot only the GC will move objects. Any 
movement requires updating all references to the object and that 
requires locating them, which requires at least some phases of the GC to 
execute.

David
-----

>
> Thanks,
> Martin Skurla


More information about the hotspot-runtime-dev mailing list