Subject: | Tk with LibXML crash |
From: | duckseazon [...] gmail.com |
Hello, whenever I'm trying to load a 290MB XML file using Tk and LibXML the script crashes. I'm on Windows 7 64bit with 8GB of RAM using strawberry 'perl 5, version 30, subversion 0 (v5.30.0) built for MSWin32-x64-multi-thread'. Tk and LibXML were downloaded from CPAN 3 days ago
Here's the script. It doesn't crash on smaller XML files (~200MB), just crashes on the big ones. XML loads fine when I remove Tk from the script.
use strict;
use warnings;
use XML::LibXML;
use Tk;
my $xpc;
my $mw = MainWindow->new( -title => 'GUI' );
$mw->Button(
-text => 'Load XML',
-command => [ \&tk_Load_Export , \$xpc ],
)->grid(-column => '0', -row => '0', -sticky => 'e');
MainLoop;
sub tk_Load_Export {
my( $ref_xpc ) = @_;
#~ my $filename = $mw->getOpenFile( -title => 'Load XML', -default+extension => '.xml', -initialdir => '.' ) or return;
my $filename = 'big.xml';
import_XML( $filename , $ref_xpc );
}
sub import_XML {
my( $filename , $ref_xpc ) = @_;
print "Reading the XML file $filename\n\n";
undef $$xpc; # free previous $dom
my $dom = XML::LibXML->load_xml(location => $filename, huge => 1);
$$xpc = XML::LibXML::XPathContext->new($dom);
print "XML imported\n";
}
The script crashes with:
Show quoted text
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:86: my $w = shift;
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:87: $w->configure('-state =>'normal') if ($w->cget('-state') ne 'disabled');
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:90: if (exists $w->{__relief__})
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:92: if (exists $w->{__prelief__} &&
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:97: delete $w->{__relief__};
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:98: delete $w->{__prelief__};
>> C:/Strawberry/perl/site/lib/Tk/Button.pm:100: undef $Tk::window;
>> C:/Strawberry/perl/site/lib/Tk.pm:424: DoOneEvent(0);
>> C:/Strawberry/perl/site/lib/Tk.pm:424: DoOneEvent(0);
Free to wrong pool 369f80 not 29dd8a50 at C:/Strawberry/perl/site/lib/Tk.pm line 424.