Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the Tangram CPAN distribution.

Report information
The Basics
Id: 25145
Status: patched
Priority: 0/
Queue: Tangram

Owner: daveh [...]
Requestors: pt [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: memory leak patch (Tangram/Schema/Node)
Date: Mon, 26 Feb 2007 01:44:00 +0200
To: via RT <bug-Tangram [...]>
From: Assen Tchorbadjiev <pt [...]>
Download (untitled) / with headers
text/plain 895b
Hello, attached is a patch against the latest HEAD sources that resolves some memory leaks being reported due to unfreed closure(s) inside the for_conforming() & for_composing() routines. I think its save to free them this way since the methods are 'void' anyway. The memleaks can be caught with Devel::Leak (or more handy Apache::Leak). Attached is also an example script derived from t/musicstore/01-simple.t, that shows how to quick check the memleak difference. W/o the patch it reports about 488 leaks when selecting all CD::Artist types, whereas after the patch they drop to about 95. The example script has to be invoked after the 00-deploy & 01-simple have passed so it has any data to select. For example: # cd Tangram && make test # && abort after the musicstore/00,01 # copy 99-leaks.t to the t/musicstore # perl -It -Iblib/lib t/musicstore/99-leaks.t Regards, Assen
Download 99-leaks.t
text/x-perl 708b
# -*- perl -*- # test script for the Persistathon - set TANGRAM_TRACE=1 in the # environment for a nice log of what queries Tangram is running. use lib "t/musicstore"; use Prerequisites; use strict; use Tangram::Storage; use Apache::Leak; # various items that will "persist" between test blocks use vars qw($storage); my ($oid, $id, $r_cd, $r_artist, $band, $row, $join, $filter); my $var; open FO, '>', \$var or die ($!); close STDERR; leak_test ( sub { $storage = DBConfig->dialect->connect(MusicStore->schema, DBConfig->cparm); $r_artist = $storage->remote("CD::Artist"); my @artists = $storage->select( $r_artist, ); $storage->disconnect(); }, undef, \*FO, ); close FO; print $var;
text/x-diff 452b
diff --git a/lib/Tangram/Schema/ b/lib/Tangram/Schema/ index 881fbd7..0218554 100644 --- a/lib/Tangram/Schema/ +++ b/lib/Tangram/Schema/ @@ -35,6 +35,7 @@ sub for_conforming }; $traverse->($class); + undef $traverse; } #--------------------------------------------------------------------- @@ -64,6 +65,7 @@ sub for_composing }; $traverse->($class); + undef $traverse; } sub get_exporter {

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to