Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

In fact, the code:

delete $machines{+shift};

is from the original author of FSA::Rules. I just added the debug messages and the Devel::FindRef.

You were right about your guess: I moved the usage of Devel::FindRef to the scope of ListParser class and could get the message:

FSA::Rules=HASH(0x31cc818) [refcount 13] is +- referenced by REF(0x31d8740) [refcount 1], which is | the member 'machine' of HASH(0x31cc788) [refcount 1],

Later, in the DESTROY, Devel::FindRef gave me the same HASH address.

After a fair amount of time checking the code of FSA::Rules, I got this (I pasted only the interesting parts):

my (%machines, %states); sub new { my $class = shift; my $self = bless {}, $class; my $fsa = $machines{$self} = { done => undef, notes => {}, stack => [], table => {}, self => $self, }; $def->{name} = $state; $def->{machine} = $self; $fsa->{table}{$state} = $obj; push @{$fsa->{ord}}, $obj; $states{$obj} = $def;

I created a new method to loop over %machines and %states and setting the references to the FSA::Rules object to undef. and invoked it at the end of parse method from ListParser.

After that, I could finally get the object termination in the moment that I want:

freeing myself after cleanup FSA::Rules=HASH(0x214e718) [refcount 1] is referenced by REF(0x1a30bc8) [refcount 1], which is the lexical '$fsa' in CODE(0x1a30958) [refcount 3], which is the global &Siebel::Srvrmgr::ListParser::parse. finished free method destroying FSA::State=HASH(0x215a658) destroying FSA::State=HASH(0x215a550) destroying FSA::State=HASH(0x215a430) destroying FSA::State=HASH(0x215a310) destroying FSA::State=HASH(0x215a1f0) destroying FSA::State=HASH(0x215a0d0) destroying FSA::State=HASH(0x2159fb0) destroying FSA::State=HASH(0x2159e90) destroying FSA::State=HASH(0x2159d58) destroying FSA::State=HASH(0x2159c50) destroying FSA::State=HASH(0x214e910) FSA::Rules is dead freeing myself after cleanup FSA::Rules=HASH(0x215c148) [refcount 1] is referenced by REF(0x1a30bc8) [refcount 1], which is the lexical '$fsa' in CODE(0x1a30958) [refcount 3], which is the global &Siebel::Srvrmgr::ListParser::parse. finished free method destroying FSA::State=HASH(0x214e5e0) destroying FSA::State=HASH(0x214da28) destroying FSA::State=HASH(0x1a97978) destroying FSA::State=HASH(0x215bed8) destroying FSA::State=HASH(0x2130628) destroying FSA::State=HASH(0x2137b50) destroying FSA::State=HASH(0x214e508) destroying FSA::State=HASH(0x215bcf8) destroying FSA::State=HASH(0x2137a48) destroying FSA::State=HASH(0x2141cf8) destroying FSA::State=HASH(0x2127788) FSA::Rules is dead ListParser is gone End of program daemon is gone


Alceu Rodrigues de Freitas Junior
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

In reply to Re^2: Missing reference and memory leak by glasswalk3r
in thread Missing reference and memory leak by glasswalk3r

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (3)
    As of 2018-03-24 02:42 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (297 votes). Check out past polls.