How are these locks cleaned up? 

And another trick is to use a striped lock. So have an array of predefined locks and based on the address you calculate the index. This way you can't get lock leakage. At the cost of course of potential false contention.