title: Is there a way to know who holds a reference to an object in Go?
body: <p>I am currently trying to debug a nasty memory leak in <a href="https://github.com/tendermint/tendermint/pull/1173" rel="noreferrer">our Go code</a>.</p>
  
  <p>What I know:</p>
  
  <ul>
  <li>where memory is going (<code>pprof</code> with <code>-base</code> flag)</li>
  <li>why new memory is being allocated ("reconnect" feature in our code)</li>
  <li>number of goroutines is not growing (<code>runtime.NumGoroutine()</code>)</li>
  <li>if I do <code>object = nil</code>, memory will be garbage collected (good! but now I have data races with other go-routines that are using this object)</li>
  </ul>
  
  <p>What I don't know:</p>
  
  <ul>
  <li>why new memory is not being garbage collected. for that I need to know who holds a reference(s) to an object.</li>
  </ul>
  
  <p>Thank you for your time and any advice!</p>