Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Object::InsideOut leaks memory when using threads::shared

by menth0l (Monk)
on Oct 13, 2010 at 21:17 UTC ( #865164=note: print w/ replies, xml ) Need Help??


in reply to Re: Object::InsideOut leaks memory when using threads::shared
in thread Object::InsideOut leaks memory when using threads::shared

Jerry D. Hedden has already answered to my bug report. He states that:

(...)it's not an OIO bug. It's a problem with the perl interpreter and/or threads::shared.
He managed though to fix this in new OIO version that he ut on CPAN (1.71):
http://cpansearch.perl.org/src/JDHEDDEN/Object-InsideOut-3.71/Changes

Thank you all for help and thanks to Jerry for quick reaction!


Comment on Re^2: Object::InsideOut leaks memory when using threads::shared
Re^3: Object::InsideOut leaks memory when using threads::shared
by BrowserUk (Pope) on Oct 13, 2010 at 21:39 UTC
    it's not an OIO bug. It's a problem with the perl interpreter and/or threads::shared.

    Interesting fix/workaround:

    @@ -634,19 +634,23 @@ # Save deleted IDs for later reuse my $reuse = $GBL{'id'}{'reuse'}; + lock($reuse) if $GBL{'share'}{'ok'}; if ($id) { - lock($reuse) if $GBL{'share'}{'ok'}; if (! exists($$reuse{$tree})) { $$reuse{$tree} = make_shared([]); } my $r_tree = $$reuse{$tree}; if (! exists($$r_tree[$thread_id])) { - $$r_tree[$thread_id] = make_shared({}); - } elsif (exists($$r_tree[$thread_id]{$id})) { - warn("ERROR: Duplicate reclaimed object ID ($id) in class + tree for $tree in thread $thread_id\n"); - return; + $$r_tree[$thread_id] = make_shared([]); + } else { + foreach (@{$$r_tree[$thread_id]}) { + if ($_ == $id) { + warn("ERROR: Duplicate reclaimed object ID ($id) +in class tree for $tree in thread $thread_id\n"); + return; + } + } } - $$r_tree[$thread_id]{$id} = $id; + push(@{$$r_tree[$thread_id]}, $id); return; } @@ -654,9 +658,9 @@ if (exists($$reuse{$tree}) && exists($$reuse{$tree}[$thread_id])) { - keys(%{$$reuse{$tree}[$thread_id]}); - if ((my $id) = each(%{$$reuse{$tree}[$thread_id]})) { - return (delete($$reuse{$tree}[$thread_id]{$id})); + my $id = pop(@{$$reuse{$tree}[$thread_id]}); + if (defined($id)) { + return $id; } }

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://865164]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-07-28 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (195 votes), past polls