title: In Scala, would the following pattern match prevent excessive garbage collection?
body: <p>I'm doing some heavy database processing and am getting the error message</p>
  
  <blockquote>
    <p>GC overhead limit exceeded</p>
  </blockquote>
  
  <p>Caused by</p>
  
  <blockquote>
    <p>ResultSet getString</p>
  </blockquote>
  
  <p>In my code I have checks such as the following</p>
  
  <pre><code>val myVal = result.getString("COLUMN")
  if (myVal == ...) {}
  </code></pre>
  
  <p>What I'm wondering is if I change this </p>
  
  <pre><code>result.getString("COLUMN") match {
  case ...
  }
  </code></pre>
  
  <p>Does this save a variable from having to be created and garbage collected?  Or is this some internal mechanism which means that this happens anyway?</p>
  
  <p>Edit: result is a JDBC ResultSet</p>