SPUG: Dying Children
Dan Ebert
mathin at mathin.com
Tue Sep 21 10:38:36 CDT 2004
The things being freed are hashes (actually hashrefs). They are not
refered to by anything else. This is basically how it is set up (the loop
is a bit more complex than this and there is more processing in the hash
building, but this is the nuts and bolts. It is just a simple hash, and
the writeFile sub just sorts and writes the keys to a file.):
my %hash;
foreach my $blah (@data) {
# build hash
$hash{$blah} = 1;
if(condition) {
#fork off child
my $pid = fork;
unless($pid) {
&writeFile(\%hash)
POSIX::_exit(0);
}
# clear hash for new data
%hash = ();
}
}
Dan.
----------------------------------------------------------
Immigration is the sincerest form of flattery.
- Unknown
----------------------------------------------------------
On Mon, 20 Sep 2004, Yitzchak Scott-Thoennes wrote:
> On Mon, Sep 20, 2004 at 12:47:18PM -0700, Dan Ebert <mathin at mathin.com> wrote:
> > You can get around this by calling POSIX::_exit(0). (I know you are not
> > supposed to use &_ sub routines from a module :), but this was suggested
> > by the Camel book as a way of avoiding the execution of END blocks, so
> > what the hell.) It bypasses the destructor processing (and END blocks).
>
> In this case, the _ doesn't indicate a module-private sub, it indicates that
> it calls the C _exit function:
>
> http://www.opengroup.org/onlinepubs/009695399/functions/_exit.html
>
> The main concern is that file buffers may not be flushed.
>
> I'm curious to know more about the situation you have; are you using glibc?
> If so, what version? Are these things being freed objects? Referred to
> by objects?
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at mail.pm.org http://spugwiki.perlocity.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, Location Unknown
> WEB PAGE: http://www.seattleperl.org
>
More information about the spug-list
mailing list