PHP memory problem

2002-01-02 Thread Dan Liu

Hi everyone,
when we execute queries through MySQL using PHP, a significant amount of memory is 
being used in the process.  We have noticed that the memory is not being released 
again for several hours.  Despite attempts to force it to release memory in the code, 
the problem is still occuring.  Does anyone know anything about why this behavior may 
be occuring and any solutions we could try?  Is this a PHP problem or a MySQL problem? 
 Using pconnect versus connect does not appear to be the problem.

Dan


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: PHP memory problem

2002-01-02 Thread Jonathan Hilgeman

This sounds like it could be a caching issue. Are you running a Windows or
UNIX-based machine? Each should have methods to track what processes are
using memory and how much memory they are using. 

- Jonathan

-Original Message-
From: Dan Liu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 02, 2002 11:33 AM
To: 
Subject: PHP memory problem


Hi everyone,
when we execute queries through MySQL using PHP, a significant amount of
memory is being used in the process.  We have noticed that the memory is not
being released again for several hours.  Despite attempts to force it to
release memory in the code, the problem is still occuring.  Does anyone know
anything about why this behavior may be occuring and any solutions we could
try?  Is this a PHP problem or a MySQL problem?  Using pconnect versus
connect does not appear to be the problem.

Dan


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: PHP memory problem

2002-01-02 Thread John Kemp

There are a couple of potential things you could change.

Dan,

1. On the MySQL end, there is a configuration value or two for timing 
out sleeping MySQL queries - by default the timeouts are set to be 8 
hours. You can make the timeouts less in my.cnf - However, be careful. 
You may have connections that NEED to be open that long. Think about 
whether you need to have persistent connections to the database. If not, 
then set the values lower for the following:

# 14400 seconds is 4 hours, (default is 8 hours or 28800 seconds)
# if you don't have the need for persistent db connections, you can set 
these much lower - ie. 10 minutes say, or an hour

set-variable = interactive_timeout=14400
set-variable = wait_timeout=14400

2. On The Apache/PHP end - if someone presses the 'stop' button in the 
browser, your script won't necessary complete, which means it may hold a 
db connection, which means Apache/PHP won't kill the process holding the 
db connection. This can cause the process to hold the memory. A good way 
to test this is to check the number of sleeping connections (ps auwx | 
grep mysqld | wc -l will give you the number) and then restart your web 
server, and run the same command again to check the number of mysqld's. 
You can also run mysqladmin processlist to check this stuff. You should 
also make sure that in your code you are definitely closing your 
database connections (even if an error occurs)

John


Dan Liu wrote:

 Hi everyone,
 when we execute queries through MySQL using PHP, a significant amount of memory is 
being used in the process.  We have noticed that the memory is not being released 
again for several hours.  Despite attempts to force it to release memory in the code, 
the problem is still occuring.  Does anyone know anything about why this behavior may 
be occuring and any solutions we could try?  Is this a PHP problem or a MySQL 
problem?  Using pconnect versus connect does not appear to be the problem.
 
 Dan
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 .
 
 



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php