Re: Memory leaks when fetching array columns

Lamprecht <[email protected]> Fri, 07 Nov 2014 22:22:21 +0100
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Am 07.11.2014 um 16:10 schrieb Lamprecht:
> Am 04.11.2014 um 16:32 schrieb Greg Sabino Mullane:
>
>> I verified that the problem is in that block by setting:
>>
>> $dbh->{pg_expand_array} = 0;
>>
>> If that is set, no leak is seen in the test case.
>>
>>
>
>
> I tried to reproduce with Ubuntu 14.04 / perl 5.18.2 / PG 9.3.5
> DBD::Pg 3.4.2
>
> I set $dbh->{pg_expand_array} = 0;
>
> No matter if I select the text or the array column, I still get an inc of 1 SV
> per round.
> But what makes it much worse is a growth of process memory: It increases by 0.4
> MB each round. I doubt that this is all lost in the one SV that D::L reports...
>
> Cheers, Christoph
>

Checked with perlbrew installs of perl-5.16.3 and perl-5.21.5 - got the same 
results.
Unfortunately Git checkout commit 18b5b8f0d4f82fdc4a0 fails tests on all the 
three perls I tried:


t/01connect.t ....... 1/15 #
# DBI                         Version 1.63
# DBD::Pg                     Version 3.4.2
# Perl                        Version 5.18.2
# OS                          linux
# PostgreSQL (compiled)       90305
# PostgreSQL (target)         90305
# PostgreSQL (reported)       PostgreSQL 9.3.5 on i686-pc-linux-gnu, compiled by 
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 32-bit
# Default port                5432
# DBI_DSN                     dbi:Pg:;client_encoding=utf8
# DBI_USER                    postgres
# Test schema                 dbd_pg_testschema
# LANG                        de_DE.UTF-8
# array_nulls                 on
# backslash_quote             safe_encoding
# client_encoding             UTF8
# server_encoding             UTF8
# standard_conforming_strings on
# Adjusted:                   DBI_DSN
t/01connect.t ....... ok
t/01constants.t ..... ok
t/02attribs.t ....... 254/260 	(in cleanup) DBD::Pg::st DESTROY failed: no 
connection to the server at t/02attribs.t line 1622.
t/02attribs.t ....... ok
t/03dbmethod.t ...... 1/547
#   Failed test 'DB handle method "do" works properly with passed-in array with 
undefined entries'
#   at t/03dbmethod.t line 133.
#     Structures begin differing at:
#          $got->[1][2] = 'ARRAY(0x8728480)'
#     $expected->[1][2] = 'asasa'
t/03dbmethod.t ...... 158/547 # Looks like you failed 1 test of 547.

...

Test Summary Report
-------------------
t/03dbmethod.t    (Wstat: 256 Tests: 547 Failed: 1)
   Failed test:  11
   Non-zero exit status: 1
t/03smethod.t     (Wstat: 65280 Tests: 90 Failed: 0)
   Non-zero exit status: 255
   Parse errors: Bad plan.  You planned 122 tests but ran 90.
t/09arrays.t      (Wstat: 65280 Tests: 144 Failed: 46)
   Failed tests:  5, 7, 10, 12, 15, 17, 20, 22, 25, 27, 46
                 48, 51, 53, 56, 58, 61, 63, 66, 68, 71
                 73, 76, 78, 81, 83, 86, 88, 91, 93, 96
                 98, 101, 103, 106, 108, 111, 113, 116, 118
                 121, 123, 126, 128, 141, 143
   Non-zero exit status: 255
   Parse errors: Bad plan.  You planned 200 tests but ran 144.
t/30unicode.t     (Wstat: 65280 Tests: 32 Failed: 0)
   Non-zero exit status: 255
   Parse errors: No plan found in TAP output
Files=21, Tests=1719, 32 wallclock secs ( 0.73 usr  0.09 sys +  8.44 cusr  0.90 
csys = 10.16 CPU)
Result: FAIL
Failed 4/21 test programs. 47/1719 subtests failed.

Christoph