Here's the broken version with MCE:#!/usr/bin/perl use strict; use warnings; use Imager; STDOUT->autoflush; my @i = (); for my $x (0 .. 9999) { my $i = Imager->new(xsize=>120, ysize=>50) or die Imager->errstr; $i->string( text => $x, color => Imager::Color->new('ffffff'), font => Imager::Font->new( file => '/System/Library/Fonts/Courier.dfont', # face => 'Courier New', # mswin size => 42, aa => 1), x => 5, y => 35 ); push @i, $i; print "\r$x" } Imager->write_multi({ file => 'gif.gif', type => 'gif', gif_loop => 0, gif_delay => 1 }, @i) or die Imager->errstr; print " frame GIF done!\n";
What am I doing wrong? Thank you#!/usr/bin/perl use strict; use warnings; use Imager; use MCE::Map; STDOUT->autoflush; MCE::Map->init( max_workers => 4, chunk_size => 1, init_relay => '' ); my @i = mce_map { my $x = $_; my $i = Imager->new(xsize=>120, ysize=>50) or die Imager->errstr; MCE::relay { print "\r$x" }; $i->string( text => $x, color => Imager::Color->new('ffffff'), font => Imager::Font->new( file => '/System/Library/Fonts/Courier.dfont', # face => 'Courier New', # mswin size => 42, aa => 1), x => 5, y => 35 ); # without next line: Segmentation fault 11 # with next line: Abort trap: 6 malloc: *** error for object # $i } [ 0 .. 9999 ]; MCE::Map->finish; Imager->write_multi({ file => 'gif.gif', type => 'gif', gif_loop => 0, gif_delay => 1 }, @i) or die Imager->errstr; print " frame GIF done!\n";
In reply to MCE segmentation fault by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |