On Tue, 29 Aug 2000, Lyle D. Brooks wrote:
> This is my first time posting to this list, so forgive me
> if this question has been asked before (I did not see it in
> the archives or in the mod_perl guide).
>
> Apache::Status seems like a nice module, but I don't understand
> what the Memory usage section is telling me.
>
> For a given package, I have a function foo() that has a line
> like this.
>
>
> foo 48293 bytes | 1172 OPs
>
>
> Here's my questions...
>
> 1) 48293 bytes is what? Is that code?, stack?, data? or a combination
> of some of the three?
TerseSize measures the sizeof() all structures (and strlen() of any
strings) pointed to by the syntax (op) tree, lexical variables and
globals.
> 2) 1172 OPs - what's an OPs? Is it good to have more or less? How does
> that affect memory usage?
see matt's explanation. less is better.
> 3) Without changing the code, I can reload the memory usage page and the
> same function foo() will generally have the same number of bytes, but
> not always. The OPs always seem to remain the same number however. The
> bytes can vary but they don't seem to grow a great deal. Is this varying
> number a memory leak in the function? If not, what causes the number to
> vary from one invocation to the next?
i'm not sure if stas has added a section to guide, but this has been
explained a bunch of times here on the list. in a nutshell, Perl hangs
onto many of the allocations your scripts makes, such as the first
time a variable is used by a script (they are all NULL at compile
time), string copies, array and hash sizes, scratch pads for things like
join, concatination, etc. B-LexInfo includes a handler to show this
behavior in action.