title: React component state memory leak
body: <p>The state in my React component does not get garbage collected when the component is dismounted, causing memory leak. I am using react@15.5.4 on Chrome 10.12.5 on macOS Sierra.</p>
  
  <p>I am setting a state in <code>componentDidMount</code> like <a href="https://github.com/dgraph-io/dgraph/blob/master/dashboard/src/containers/GraphContainer.js#L61" rel="nofollow noreferrer">this</a>.</p>
  
  <p>To confirm the memory leak, I have added the following to my <code>componentDidMount</code>:</p>
  
  <pre><code>let arr = new Uint8Array(1024 * 1024 * 30);
  this.setState({
    test: arr
  });
  </code></pre>
  
  <p>and took a heap snapshot to confirm 30MB of Uint8Array allocated on heap.</p>
  
  <p>Then, I have confirmed that the component gets dismounted by <code>console.log</code> in <code>componentWillUnmount</code>.</p>
  
  <p>When I take a heap snapshot afterwards, even after allowing ample time for garbage collection to happen, Uint8Array remains in the heap.</p>
  
  <p>Any ideas about where to start debugging this issue? Or any observation from the source code?</p>