Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I interpret the output of Devel::Leak

Tags:

perl

I've run Devel::Leak in my program and I don't understand the output it's giving me.

To start, I see it's printing a list of pointers. Can I get that list in an array? Then I can use FindRef to see where it's coming from.

For example:

new 0xaebc28 : SV = PVGV(0x30e7e48) at 0xaebc28
  REFCNT = 1
  FLAGS = (GMG,SMG)
  IV = 0
  NV = 0
  PV = 0
  MAGIC = 0x2db7dc0
    MG_VIRTUAL = &PL_vtbl_glob
    MG_TYPE = PERL_MAGIC_glob(*)
    MG_OBJ = 0xaebc28
  NAME = "SUPER::"
  NAMELEN = 7
  GvSTASH = 0x76b228    "IO::File"
  GP = 0x314b170
    SV = 0x30283c8
    REFCNT = 1
    IO = 0x0
    FORM = 0x0  
    AV = 0x0
    HV = 0x301fdb8
    CV = 0x0
    CVGEN = 0x0
    GPFLAGS = 0x0
    LINE = 161
    FILE = "/mypath/perl_install/perl/lib/5.8.9/x86_64-linux/IO/File.pm"
    FLAGS = 0x0
    EGV = 0xaebc28      "SUPER::"

or a bunch of smaller entries:

new 0x161c268 : SV = RV(0x3029b40) at 0x161c268
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x161c218

What do I do with this? I get the Perl struct stuff (magic, iv, pv,..), but how do I go from these lines to knowing where my leak is occurring?

like image 722
mmccoo Avatar asked Aug 24 '10 18:08

mmccoo


1 Answers

Take a look at Devel::LeakTrace for a module which also records where memory has been allocated.

like image 156
vladr Avatar answered Nov 02 '22 05:11

vladr