Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve #1 - fix reference cycle in reggrp closures
replace use of $self in the reggrp_data closures that was causing the following memory cycle (amongst others): Cycle #1 JavaScript::Packer A->{_reggrp_comments} => Regexp::RegGrp B Regexp::RegGrp B->{_reggrp} => @C @c->[4] => Regexp::RegGrp::Data D Regexp::RegGrp::Data D->{_replacement} => &E closure &E, $self => $F $F => JavaScript::Packer A now we are using package variables set when minify is called thus handle any change to the state and remove the cycles bump VERSION and Changes for CPAN release
- Loading branch information
Showing
5 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
use JavaScript::Packer; | ||
|
||
if (! eval "use Test::Memory::Cycle; 1;" ) { | ||
plan skip_all => 'Test::Memory::Cycle required for this test'; | ||
} | ||
|
||
my $packer = JavaScript::Packer->init; | ||
memory_cycle_ok( $packer ); | ||
|
||
my $js = ' | ||
$(document).ready(function(e) { | ||
try { | ||
// $("body select").msDropDown(); | ||
$("#payin").msDropdown({visibleRows:3,rowHeight:30}); | ||
$("#payout").msDropdown({visibleRows:8,rowHeight:30}); | ||
$("#lang").msDropdown({visibleRows:2,rowHeight:16}); | ||
} catch(e) { | ||
alert(e.message); | ||
} | ||
}); | ||
'; | ||
|
||
for ( 1 .. 5 ) { | ||
ok( $packer->minify( \$js,{} ),'minify' ); | ||
} | ||
|
||
memory_cycle_ok( $packer ); | ||
done_testing(); |