Sometimes it's convenient to create a hash table where the hash function uses the hashed object's address. The hash function is easy to implement and cheap to execute.
But there's a problem if you are working on a system which uses some form of copying garbage collection because after an object has been moved the previously calculated hash value is incorrect. Even rehashing the table during or after garbage collection seems problematic since (in principle) a hash function could consume memory and trigger another garbage collection.
My question is how to work around these issues. I'm not seeing any clean solution without some kind of compromise.