in reply to Re: Re: Re: Re: Finding the size of a variable
in thread Finding the size of a variable

I think walking the entire symbol table on every subroutine call is basically non-feasible. Devel::Profiler does it as startup and it takes a long time for large programs.

I'm looking at the possibility of using GTop or Proc::ProcessTable to do the checking. There are some definite drawbacks, but it might still work to find largish memory leaks.

-sam

  • Comment on Re: Re: Re: Re: Re: Finding the size of a variable

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Finding the size of a variable
by Elian (Parson) on Nov 11, 2002 at 20:53 UTC
    Oh, I dunno, it doesn't take that long. And unfortunately it's the only really effective way to see how much memory's currently in use, though even then there are some interesting bits to deal with.

    Also, don't forget that Devel::Profiler is pure perl, and thus has a fair amount of overhead. Devel::Size is entirely in C, and a fair amount faster. I'd guess we'd see about a factor of 100 speedup over a perl version, but it might be upwards of 200 to 300 times faster for what it does, as well as immune to a lot of the problems you'd find doing this in perl. (It's not tripped up by tying or overloading, for example)

      Gee, that sounds great! When can I use it? ;)

      I'll be very interested to see just how fast it can walk every data structure in use by a large system like Bricolage. My gut reaction is still "a long time" but you clearly would know better than I!

      -sam

        Well, try it now! :)

        If the walk of \%main:: is unmanageable now, getting CVs right won't help. OTOH, if it's fast now, it won't get a whole lot slower later...