Re: Non-Deterministic / Unpredictable Behavior (Again) [SOLVED]

Jeff Kesselman <[email protected]> Sat, 12 Apr 2008 17:10:10 -0400
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
Randall R Schulz wrote:
> On Saturday 12 April 2008 07:54, Attila Szegedi wrote:
>
>> On 2008.04.12., at 16:12, Randall R Schulz wrote:
>>
>>> ...
>>>
>> In order to make it harder (ideally, impossible) to figure out an
>> object's address in the address space of the process, the identity
>> hash code function actually uses an automorphic transformation on the
>> address space, using the object's first allocated address (the
>> transformation in question ain't exactly a XOR if I remember
>> correctly from last time I dug in Sun JVM source code, but is
>> similar). The key for the transformation (i.e. the XOR value) is
>> randomly chosen on each JVM startup, which would explain the
>> differing behavior.
>>
>
> Fascinating.
>
> Why try to obfuscate the virtual address of instances?
>
I don't know if there is another reason, but one is to prevent you from
writing code that depends on things like the order of allocation of the
objects.

Java is a "fail early" language.  The design is intended so that
mistakes that could make the code fail eventually fail as early as
possible.  I could see this being an intent to make code that broke the
rules and tried to depend on order of allocation fail early.

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com