Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Hashtbls with physical equality?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-15 (23:42)
From: Stefan Monnier <monnier@i...>
Subject: Re: Hashtbls with physical equality?
> Starting with the  fact that it returns a 32-bit *int* (and what happens
> when you have more  than 4 billion objects?  Possible in a 64-bit
> system!).

It's not an object-id, it's a hash code.  I.e. it does not guarantee that

     a != b  ==>  a.hashCode() != b.hashCode()

so the 32bit restriction is only a serious problem once the size of your
hashtable gets close to a billion of buckets.
Sure that can happen, but not nearly as soon as a 4GB Java process or even
a Java process with 4 billion objects.