<p>It is a recursive attributes hash chain when call search on the same<br>
resultset many times. It looks like pseudo-leak with long-lived resultsets.</p>
<p>In our application (that long-lived daemon) we use something like this:</p>
<div class="highlight"><pre><span class="k">sub </span><span class="nf">periodic_refresh</span> <span class="p">{</span>
<span class="n">state</span> <span class="nv">$rs</span> <span class="o">=</span> <span class="nv">$schema</span><span class="o">-></span><span class="n">resultset</span><span class="p">(</span><span class="s">'ServerBackend'</span><span class="p">)</span><span class="o">-></span><span class="n">search</span><span class="p">({</span><span class="n">status</span><span class="o">=></span><span class="s">'active'</span><span class="p">},{</span><span class="n">order_by</span><span class="o">=></span><span class="s">'me.id'</span><span class="p">,</span><span class="n">prefetch</span><span class="o">=></span><span class="s">'Server'</span><span class="p">});</span>
<span class="k">my</span> <span class="nv">@fresh_backends</span> <span class="o">=</span> <span class="nv">$rs</span><span class="o">-></span><span class="n">all</span><span class="p">;</span> <span class="c1"># now we use this workaround: $rs->search; but it is slower because new resultset created on every iteration</span>
<span class="c1"># other refresh logic</span>
<span class="p">}</span>
</pre></div>
<p>This patch fix a problem.<br>
I'm just not sure of a good name for the test file. Now it is 110leaktrace.t, but it can be renamed to something more appropriate.</p>
<hr>
<h4>You can merge this Pull Request by running</h4>
<pre> git pull https://github.com/vovkasm/dbix-class fix-memleak-when-reuse-rs</pre>
<p>Or view, comment on, or merge it at:</p>
<p> <a href='https://github.com/dbsrgits/dbix-class/pull/29'>https://github.com/dbsrgits/dbix-class/pull/29</a></p>
<h4>Commit Summary</h4>
<ul>
<li>Fix memleak for long-lived resultsets.</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/dbsrgits/dbix-class/pull/29/files#diff-0">lib/DBIx/Class/Storage/DBI.pm</a>
(4)
</li>
<li>
<strong>A</strong>
<a href="https://github.com/dbsrgits/dbix-class/pull/29/files#diff-1">t/110leaktrace.t</a>
(20)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/dbsrgits/dbix-class/pull/29.patch'>https://github.com/dbsrgits/dbix-class/pull/29.patch</a></li>
<li><a href='https://github.com/dbsrgits/dbix-class/pull/29.diff'>https://github.com/dbsrgits/dbix-class/pull/29.diff</a></li>
</ul>