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
Memory statistics tool
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] Memory statistics tool
Dr. Thomas Fischbacher wrote:
> The OCaml manual gives no guarantee that Hashtbl.hash does not cons, so
> I cannot assume this.

Indeed, Hashtbl.hash can cons, but this does not contradict my point: 
its result does not depend on the physical location of objects in memory
(if it did, it would be impossible to use this function at all).

> Now, without that guarantee, there is a nasty race
> condition in which the determination of the hash bucket causes objects
> to move in memory.

Yes, objects can move in memory, but what is wrong with that? Their new 
hash value will remain the same.

-- Alain