Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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

Replies are listed 'Best First'.
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?
[choroba]: just one of its angles, in fact
[LanX]: <|--
[choroba]: Reminds me of an old joke about an orchestra...
erix imagines that in a true Lancs accent
[choroba]: so a Czech orchestra rehearses a new piece by a German composer
LanX LOL of the day ... the Turkish Anonymous Alcoholics stopped their "No to alcohol" campaign for political reasons ...
LanX omg my browser is posting again on its own ...
[LanX]: choroba: GREAT JOKE! xD

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2017-03-27 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (319 votes). Check out past polls.