Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^6: Detecting memory leaks.

by Steve_BZ (Chaplain)
on May 05, 2015 at 07:09 UTC ( [id://1125676]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Detecting memory leaks.
in thread Detecting memory leaks.

Hi Anon,

I'm looking at the synopsis for Devel::Leak,

use Devel::Leak; ... setup code my $count = Devel::Leak::NoteSV($handle); ... code that may leak Devel::Leak::CheckSV($handle);

What is $handle

Regards

Steve

Replies are listed 'Best First'.
Re^7: Detecting memory leaks.
by Anonymous Monk on May 05, 2015 at 08:06 UTC

    I'm looking at the synopsis for Devel::Leak, ... What is $handle

    Its a scalar :p

    use Devel::Leak; warn Devel::Leak::NoteSV(my $handle); {my$a={};$a->{a}=$a;} warn Devel::Leak::CheckSV($handle ); __END__ 6599 at - line 2. new 003F9A6C : new 003F9B1C : 6601 at - line 4.

      Hi Anon,

      Ok, I ran it and I get a huge list of stuff like this:

      new 0x492bdd8 : new 0x36031a0 : new 0x2930a58 : new 0x2909af8 : old (1): 0 old (1): 0 old (1):

      I guess they are new octal addresses. The counts seem very high, this is what I get:

      my $mu = Memory::Usage->new(); $mu->record('before add appointment'); my $count1 = Devel::Leak::NoteSV(my $handle); __new_appointment($self1, $event1); my $count2 = Devel::Leak::CheckSV($handle ); print $count1, "\n"; print $count2, "\n"; print $count2-$count1, "\n"; $mu->record('after add appointment'); $mu->dump(); __END__ 595269 596072 803 time vsz ( diff) rss ( diff) shared ( diff) code ( diff) + data ( diff) 0 772200 ( 772200) 195796 ( 195796) 43708 ( 43708) 8 ( + 8) 369168 ( 369168) before add appointment 33 794160 ( 21960) 217104 ( 21308) 43972 ( 264) 8 ( +0) 390508 ( 21340) after add appointment

      How can I track down these addresses?

      It's a bit above my pay grade!

      Regards

      Steve.

        Well, you keep sticking notesv/checksv around chunks of code until you narrow it down, then do a code review looking for references

        Or you could try Devel::Cycle which will at least tell you what kind of cycles it found

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found