Re: Wait for background processes to complete



On 2008-01-18 02:02, grocery_stocker <cdalten@xxxxxxxxx> wrote:
On Jan 16, 9:37 pm, Ben Morrow <b...@xxxxxxxxxxxx> wrote:
The only thing that matters about %kids are its keys: we never use
the values, so they can be set to anything. I prefer using 1 since
then the values are all true; you can get slightly better memory use
with

$kids{$pid} = ();

which inserts the key but doesn't create a value for it at all, but
then you have to test with exists, which I find annoying. Since in
this case I don't test for existance of keys at all, this doesn't
matter: using 1 is just a habit.

Okay, why would you have to test for exists if

$kids{$pid} = ();

just creates something like undef.

Consider:

#!/usr/bin/perl
use warnings;
use strict;

my %kids;

$kids{3} = ();
$kids{5} = ();

for (1 .. 9) {
print "$_\n" if is_kid($_);
}

sub is_kid {
return exists($kids{$_[0]});
}
__END__
3
5

Please find an implementation for sub is_kid which doesn't use exists.

hp

.



Relevant Pages

  • Re: memory leak using system.windows.forms.timer
    ... > subroutine, memory leaks. ... > Private Sub CheckComputers() ... > Dim intCount As Integer ... > Dim mySearcher As New ...
    (microsoft.public.dotnet.languages.vb)
  • Re: memory leak using system.windows.forms.timer
    ... subroutine, memory leaks. ...     Private Sub CheckComputers() ... subroutine with a static number I still leak memory. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Memory Problem
    ... > I am using a 64MB device -- and have been pinvoking GlobalMemoryStatusCE ... > ** % Load from Memory Load returned from GlobalMemoryStatusCE ... > Each time I see the 5MB array allocation reflected properly. ... >>> Public Sub New ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Memory problem
    ... Private Sub Button1_Click(ByVal sender As System.Object, ... Dim memEnd As Long ... 'GC.Collect'Minimize the memory ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Memory Problem
    ... GlobalMemoryStatusCE ... ** % Load from Memory Load returned from GlobalMemoryStatusCE ... After first allocation of array: ... >> Public Sub New ...
    (microsoft.public.dotnet.framework.compactframework)