Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: Hashing Memory Usage

by awkmonk (Monk)
on Jul 17, 2006 at 13:11 UTC ( #561732=note: print w/replies, xml ) Need Help??

in reply to Re: Hashing Memory Usage
in thread Hashing Memory Usage

Ah a red herring - it's not hashes at all! I'm changing values in a large hash as I loop through files. The problem occurs when I come to create the key for the hash. The following code works properly on 5.6 but grows on 5.8. Delete the substitution line, and hey presto, no more leak.
use strict; my $ret = `ps v $$`; print "$ret\n"; for ( 1 .. 1000 ){ my $key = ':PERSON-NUM(1:*):NI-NUM(1:*):'; for my $bb ( "PERSON-NUM", "NI-NUM" ){ if ( $key =~ /:$bb *\( *([0-9]+) *: *([0-9\*]+) *\) *:/ ){ $key =~ s/:$bb *\( *[0-9]+ *: *[0-9\*]+ *\) *:/:$bb=1:/; } } } $ret = `ps v $$`; print "$ret\n";
Now I'm confused!

'I think the problem lies in the fact that your data doesn't fit my program'.

Replies are listed 'Best First'.
Re^3: Hashing Memory Usage
by BrowserUk (Pope) on Jul 17, 2006 at 14:37 UTC

    I ran your code with the loop iterator set 1e6, and see no memory growth under either 5.8.6 or 5.8.8.

    I seem to recall that 5.8.2 (the version shown in your OP), was a particularly buggy, short-lived release. I strongly suggest you try upgrading to something newer. My memory tells me that 5.8.3 was a pretty good build as is 5.8.6 which I still use as my default install. I encountered a few problems with 5.8.8 but I think they may have been limited to the AS-Win distribution I use.

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://561732]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2017-06-27 23:44 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (617 votes). Check out past polls.