[DBIx-Class-Devel] [dbix-class] Fix memleak for long-lived resultsets. (#29)

Vladimir Timofeev notifications at github.com
Wed Jul 10 22:27:29 GMT 2013


It is a recursive attributes hash chain when call search on the same
resultset many times. It looks like pseudo-leak with long-lived resultsets.

In our application (that long-lived daemon) we use something like this:
```perl
sub periodic_refresh {
  state $rs = $schema->resultset('ServerBackend')->search({status=>'active'},{order_by=>'me.id',prefetch=>'Server'});
  my @fresh_backends = $rs->all; # now we use this workaround: $rs->search; but it is slower because new resultset created on every iteration
  # other refresh logic
}
```
This patch fix a problem.
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.

You can merge this Pull Request by running:

  git pull https://github.com/vovkasm/dbix-class fix-memleak-when-reuse-rs

Or you can view, comment on it, or merge it online at:

  https://github.com/dbsrgits/dbix-class/pull/29

-- Commit Summary --

  * Fix memleak for long-lived resultsets.

-- File Changes --

    M lib/DBIx/Class/Storage/DBI.pm (4)
    A t/110leaktrace.t (20)

-- Patch Links --

https://github.com/dbsrgits/dbix-class/pull/29.patch
https://github.com/dbsrgits/dbix-class/pull/29.diff

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20130710/eb5f377c/attachment.htm


More information about the DBIx-Class-Devel mailing list