From: Nicholas Clark Date: Tue, 25 Oct 2005 12:54:18 +0000 (+0000) Subject: Code in wait4pid was calling hv_delete with the hash iterator X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b9a32411c4ec6251e6f3ab9bb69dd43222d7692;p=p5sagit%2Fp5-mst-13.2.git Code in wait4pid was calling hv_delete with the hash iterator currently on that entry. On aggregate this does more work, beacuse the next call to hv_iterinit() would spot the flag, and have to call the delete routine, while in the meantime any new entries can't re-use that memory. p4raw-id: //depot/perl@25848 --- diff --git a/util.c b/util.c index 96da1fc..74facce 100644 --- a/util.c +++ b/util.c @@ -2661,6 +2661,13 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags) pid = atoi(hv_iterkey(entry,(I32*)statusp)); *statusp = SvIVX(sv); len = my_sprintf(spid, "%"IVdf, (IV)pid); + /* The hash iterator is currently on this entry, so simply + calling hv_delete would trigger the lazy delete, which on + aggregate does more work, beacuse next call to hv_iterinit() + would spot the flag, and have to call the delete routine, + while in the meantime any new entries can't re-use that + memory. */ + hv_iterinit(PL_pidstatus); (void)hv_delete(PL_pidstatus,spid,len,G_DISCARD); return pid; }