title: Am I creating a leak here?
body: <p>I am using the new JsonSerializer from NETCore 3.0's System.Text.Json namespace to deserialize Json documents like this:</p>
  
  <pre><code>var result = JsonSerializer.Deserialize&lt;Response&gt;(json, options);
  </code></pre>
  
  <p>Response is defined as:</p>
  
  <pre><code>public class Response
  {
      public string Foo { get; set; }
      public JsonElement Bar { get; set; }
  }
  </code></pre>
  
  <p>The fact that <a href="https://docs.microsoft.com/en-us/dotnet/api/system.text.json.jsondocument?view=netcore-3.0" rel="noreferrer">JsonDocument</a> implements IDisposable makes me wonder if by keeping a reference to an element (<code>Bar</code>) that can be contained in a JsonDocument, will create memory leaks?</p>
  
  <p>Be advised that in general I avoid storing data as kind of "variant" type like this. Unfortunately the structure of the <code>Bar</code> property value is unknown at compile time.</p>
  
  <p>My suspicion stems from System.Text.Json advertised strength's of lazy evaluation and I'm not sure if that involves deferred I/O.</p>