Is there sample code for having a HashMap, which maps to struct instances on the Heap?

If T is the type of your struct, then instead of an integer use T* (the pointer to your struct) as data type.

There is a three part article on Hash Maps that talks about concurrency in the last part.

2 Likes