title: How to store the address pointed to by a pointer?
body: <p>I am trying to create a map of addresses of objects that I create with the time at which it is allocated. The key is the address returned by the call to <code>new()</code>. How do I get the address returned by <code>new()</code>?</p>
  
  <pre><code>type T struct{a, b int }
  
  func main(){
  
          var t int64 = time.Nanoseconds()
          memmap := make(map[uint8]int64)
          fmt.Printf("%d\n", t)
          var ptr *T = new(T)
          ptr.a = 1
          ptr.b = 2
          fmt.Printf("%d %d %p %T\n", ptr.a, ptr.b, ptr, ptr)
          //memmap[ptr] = t //gives error
          //var temp uint8 = ptr//gives error
  }
  </code></pre>
  
  <p>Please tell me what should be the type of the key field in the map so that I can store the address returned by <code>new()</code>? I plan to use <code>new()</code> with different types, get the allocated address and map it with the creation time.</p>