[PHP-DEV] memory usage

2003-01-31 Thread Walt Boring
Is there a way for me to log the peak memory usage for a php script for
php 4.3.0 ?

Thanks
Walt


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] memory usage

2003-01-31 Thread Adam Maccabee Trachtenberg
On 31 Jan 2003, Walt Boring wrote:

 Is there a way for me to log the peak memory usage for a php script for
 php 4.3.0 ?

If PHP is built with the --enable-memory-limit configuration option, it
stores the peak memory usage of each request in a note called
mod_php_memory_usage. Add the memory usage information to a LogFormat
with: 

%{mod_php_memory_usage}n

-adam

-- 
[EMAIL PROTECTED]
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] memory usage

2003-01-31 Thread Adam Maccabee Trachtenberg
On Fri, 31 Jan 2003, Adam Maccabee Trachtenberg wrote:

 If PHP is built with the --enable-memory-limit configuration option, it
 stores the peak memory usage of each request in a note called
 mod_php_memory_usage. Add the memory usage information to a LogFormat
 with: 
 
 %{mod_php_memory_usage}n

Er... by note I mean Apache note and LogFormat is for Apache's
access log.

-adam


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Memory usage of a running script. 2 methods, 2 different results

2002-05-26 Thread Hans Rakers


Hello all,

I've been working on a small extension that can tell me the memory usage of 
a script in run-time. I've discovered two methods of doing so (when PHP is 
compiled with debugging and memory limit). One is by reading the 
AG(allocated_memory) and/or AG(allocated_memory_peak) global var, the other 
is a construction like this (partially taken from the pdf extension as i 
recall):

 int allocated_memory = 0;
 int allocated_pmemory = 0;
 int allocated_memory_total = 0;
 zend_mem_header *zmh, *zpmh;

 zmh = AG(head);
 while(zmh != NULL) {
 allocated_memory += zmh-size;
 zmh = zmh-pNext;
 }
 zpmh = AG(phead);
 while(zpmh != NULL) {
 allocated_pmemory += zpmh-size;
 zpmh = zpmh-pNext;
 }
 allocated_memory_total = allocated_memory + allocated_pmemory;

Strange thing is, i get different results with these two methods. Running a 
test script that outputs results of both methods gives me the following:

1st method: Current memory usage: 545331 Peak memory usage: 545331
2nd method: Memory: regular(68423) persistent(0) total(68423)

Now i wonder which method is right, and where the difference in results 
comes from. Or am i doing this all wrong? Can someone please shed some 
light on this?

System is Linux-2.4.18, Apache_1.3.24, php-4.2.1, php built as an Apache 
module with debugging and memory limit.

Thanks in advance.


With kind regards,

Hans Rakers
Parse BV, the Netherlands


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Memory usage with Apache

2002-01-25 Thread Thomas E. Ruth

Hello,

I'm using PHP 4.0.4pl1 with Apache 1.3.14.

I have a PHP script that accumulates data for insertion into a database.
This script runs in peices and unset()'s variables that contain the data
periodically in hopes of freeing memory for the next batch of records.
Apparently it's not working that way. When I run top and run my PHP
script, the httpd process runs up to 125M of memory usage, and
segfaults.

Is there a parameter somewhere that says that httpd can't grow to over
128M of memory usage, or that PHP can't grow to more then this amount
that I can change to prevent my web server from crashing? Or perhaps a
garbage cleanup routine in PHP that actually frees memory that is no
longer being used (these arrays hold max 5X25 of small 10 char
strings). I unset these arrays after they are placed in the database
(and I free the result for the database), but memory just climbs and
climbs until the script ends (if I run it with arguments that yield
smaller results).

Thanks,

Tom

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]