On 1/26/2011 11:22 AM, Brian Raven wrote:
> -----Original Message-----
> From: perl-win32-users-boun...@listserv.activestate.com
> [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
> John Deighan
> Sent: 26 January 2011 15:18
> To: perl-win32-users@listserv.ActiveState.com; us...@httpd.apache.org;
> modp...@perl.apache.org
> Subject: experiencing Out of memory errors
>
>> We have an Apache/mod_perl application running under Windows Server2003
 >> ...etc.
>> help us.
>
> Unless it is fairly easy to create a 64 bit setup, it might be worth
> expending some effort in checking whether your belief that you don't
> have a memory leak is sustainable. This may help.
>
> http://modperlbook.org/html/14-2-6-Memory-Leakage.html

Thanks for the help, Brian. I'll check it out.

That does remind me, however, that we've tried to analyze how much memory some 
of our larger data 
structures take up. We'd previously done that using a function in the 
Devel::Size library named 
total_size. You pass it the reference to a data structure, like an array or 
hash, and it tells you 
how many total bytes it uses, including traversing all references it contains, 
recursively.

However, in an effort to reduce the memory we use (and at the same time speed 
up response time), 
we've started using thread-shared memory for cached data. Since we're on 
Windows, Apache starts a 
single process with multiple threads (technically, it's 2 processes, but the 
first just shuttles the 
request to the 2nd, which uses one of the threads to handle it). Using 
thread-shared data structures 
means that when one of the threads (i.e. "Perl interpreters") has data to 
cache, other threads can 
find and use that data since it's stored in a area accessible to all threads.

Unfortunately, the Devel::Size functions don't work correctly with 
thread-shared memory and the 
total_size function returns erroneous information (specifically, no matter how 
large the data 
structure is, it reports the same, rather small size. Perhaps it's unable to 
follow references at 
all, but I really don't know what the problem is).

Does anyone know of an alternative way to determine the amount of memory used 
by a Perl data structure?

use Devel::Size qw(total_size);
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to