#!/usr/local/bin/perl -w use strict; ## ----------------------------------------------------------------------------- sub run { my ($ncpu, $cnt) = @_; my($i, $pid); ## ------------------------------------------------------------- ## Generate Mobile Info ## -------------------- my %tmp = (); for ($i=0; $i<$cnt; $i++) { $tmp{$i} = $i; } ## --------------------------------------------------------------------- print "D> Parent - start\n"; for ($i=0; $i<$ncpu; $i++) { $pid = fork(); if (!defined($pid)) { my $err = "E> fork(): Failure, $?"; print $err, "\n"; Log::die($err); } if ($pid == 0) { print "D> Child Pid $$\n"; ## Just to ensure that child uses VM ## Not essential. my($j); for ($j=0; $j<$cnt; $j++) { $_ = $tmp{$j}; } sleep 5; ## ----------------------------------------------------- ## exit() here will cause core-dump. exit(0); } } for ($i=0; $i<$ncpu; $i++) { if (wait() < 0) { my $err = "E> Wait() Failure, $?"; print $err, "\n"; Log::die($err); } } print "D> Parent - end\n"; } ## ============================================================================= ## Causes coredump with 1G mem, (10.0-RELEASE-p3 amd64) perl v5.16.3 ## Causes coredump with 1G mem, (10.0-RELEASE-p3 amd64) perl v5.20.0 run(2, 2000000); ## NO coredump! with 1G mem, (10.0-RELEASE-p3 amd64) perl v5.14.4 #run(2, 2000000); ## Causes coredump with 1G mem, (10.0-RELEASE-p3 amd64) perl v5.14.4 #run(2, 2500000); ## NO coredump! with 2G mem, ( 6.2-RELEASE-p7 i386 ) perl v5.8.8 #run(4, 4000000); ## NO coredump! with 1G mem, (10.0-RELEASE-p9 i386 ) perl v5.16.3 #run(4, 4500000); ## ----------------------------------------------------------------------------- exit 0;