This is a multi-part message in MIME format.
------=_NextPart_000_006E_01CA4145.0D81A6F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi clint
Yes. Linux and this script looks good. We've think that part of the =
problem
is in the modules Apache is loading so this will be useful.
I also have another couple of questions:
I have found the errant code where our process jumps by 13 Mbs. One part =
does something like this:
$file_handle->read($s, $length); #$s is about 1/2 Mb
[at] data =3D unpack($format , $s);
##at this point memory usage jumps by 8 Mbs (measured using GTop->size() =
)
while ( [at] data) {
push [at] data2, [shift [at] data, shift [at] data, shift [at] data] ; # this isn't =
exact
but it looks like each element of [at] data2 becomes a reference to a 3 =
element
array - i.e the binary data was stored in triplets
}
#this loop causes another jump of 4 Mbs
return \ [at] data2;
I tried undef'ing [at] data just before the return as it is no longer used =
but
this only gained me 1/2 Mb. I would have expected to get all 8Mbs back. =
I
don't understand why not.
Also - in general terms if you do something like this (simplified):
package MyHandler;
use MyClass;
sub handler {
my $obj =3D MyClass->new();
}
........
package MyClass;
our $var;
sub new() {
$var =3D "hello world";
}
\Since the module containing the package MyClass is loaded into the
apache/mod_perl process does $var ever go out of scope once set? I think =
not - and it's memory is never freed? if this is correct and I used my
instead even then would it go out scope ?
Thank you for your patience.
regards
Justin
> Hi Justin
>
>>
>> I'm wondering if anyone can advise me on how I could go about trying
>> to understand where this 90 Mbs is comming from? Some of it must be
>> the mod_perl and apache binaries - but how much should they be, and
>> apart from the 6mb in shared memory for my pre-loaded modules, where
>> is it all comming from?
>
> You don't mention what platform you are on, but if it is linux, then
> check out this blog
>
> http://bmaurer.blogspot.com/2006/03/memory-usage-with-smaps. html
>
> and specifically this script
>
> http://www.contrib.andrew.cmu.edu/%7Ebmaurer/memory/smem.pl
>
>
> which will give you a much more accurate idea about how much memory is
> shared and where it is being used.
>
> As Perrin said, Perl data and code both go on the heap, so you won't =
be
> able to separate those two out with this tool, but combining smem.pl
> with loading modules one by one will get you a long way to a =
diagnosis.
>
> clint
------=_NextPart_000_006E_01CA4145.0D81A6F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18812">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2 face=3DArial><FONT size=3D3 face=3D"Times New =
Roman">Hi
clint<BR><BR>Yes. Linux and this script looks good. We've think that =
part of the
problem <BR>is in the modules Apache is loading so this will be =
useful.<BR><BR>I
also have another couple of questions:<BR><BR>I have found the errant =
code where
our process jumps by 13 Mbs. One part <BR>does something like
this:<BR><BR>$file_handle->read($s, $length); #$s is about 1/2
Mb<BR> [at] data =3D unpack($format , $s);<BR>##at this point memory usage =
jumps by 8
Mbs (measured using GTop->size() )<BR><BR>while ( [at] data) {<BR>push =
[at] data2,
[shift [at] data, shift [at] data, shift [at] data] ; # this isn't exact =
<BR>but it
looks like each element of [at] data2 becomes a reference to a 3 element =
<BR>array -
i.e the binary data was stored in triplets<BR>}<BR>#this loop causes =
another
jump of 4 Mbs<BR><BR>return \ [at] data2;<BR><BR>I tried undef'ing [at] data just =
before
the return as it is no longer used but <BR>this only gained me 1/2 Mb. I =
would
have expected to get all 8Mbs back. I <BR>don't understand why
not.<BR><BR><BR>Also - in general terms if you do something like this
(simplified):<BR><BR>package MyHandler;<BR><BR>use MyClass;<BR><BR>sub =
handler
{<BR>my $obj =3D MyClass->new();<BR>}<BR><BR>.......<BR>package
MyClass;<BR><BR>our $var;<BR>sub new() {<BR>$var =3D "hello
world";<BR>}<BR><BR><BR>\Since the module containing the package MyClass =
is
loaded into the <BR>apache/mod_perl process does $var ever go out of =
scope once
set? I think <BR>not - and it's memory is never freed? if this is =
correct and I
used my <BR>instead even then would it go out scope ?<BR><BR><BR>Thank =
you for
your =
patience.<BR><BR>regards<BR><BR>Justin<BR><BR><BR><BR><BR><BR><BR>> =
Hi
Justin<BR>><BR>>><BR>>> I'm wondering if anyone can =
advise me on
how I could go about trying<BR>>> to understand where this 90 Mbs =
is
comming from? Some of it must be<BR>>> the mod_perl and apache =
binaries -
but how much should they be, and<BR>>> apart from the 6mb in =
shared memory
for my pre-loaded modules, where<BR>>> is it all comming
from?<BR>><BR>> You don't mention what platform you are on, but if =
it is
linux, then<BR>> check out this blog<BR>><BR>> =
</FONT><A
href=3D""><FONT size=3D3
face=3D"Times New =
Roman">http://bmaurer.blogspot.com/2006/03/memory-usage-with -smaps.html</=
FONT></A><BR><FONT
size=3D3 face=3D"Times New Roman">><BR>> and specifically this
script<BR>><BR>> </FONT><A href=3D""><FONT size=3D3
face=3D"Times New =
Roman">http://www.contrib.andrew.cmu.edu/%7Ebmaurer/memory/s mem.pl</FONT>=
</A><BR><FONT
size=3D3 face=3D"Times New Roman">><BR>><BR>> which will give =
you a much
more accurate idea about how much memory is<BR>> shared and where it =
is being
used.<BR>><BR>> As Perrin said, Perl data and code both go on the =
heap, so
you won't be<BR>> able to separate those two out with this tool, but
combining smem.pl<BR>> with loading modules one by one will get you a =
long
way to a diagnosis.<BR>><BR>> clint =
</FONT><BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_006E_01CA4145.0D81A6F0--
