Re: [PHP-DB] Memory

2005-05-01 Thread Georg Richter
Am Mi, den 27.04.2005 schrieb [FOTOList.com] Suporte um 15:46:
> Hi,
> 
> When I get something from database, using this function: pg_query 
> (postgresql) or mysql_query and after put this result in somes 
> variables, Am I using double memory to same data or this new variable 
> point to variable with db result?

A normal mysql_query or mysqli_query function allocates a char** pointer
(in libmysql) for all data in resultset until it's freed via
mysql_free_result.

If you have to retrieve a large amount of data (and you don't use nested
selects) you should use mysql_unbuffered_query instead. This method can
be also faster.

/Georg

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



Re: [PHP-DB] Memory. .

2005-04-27 Thread Martin Norland
[FOTOList.com] Suporte wrote:
Hi,
When I get something from database, using this function: pg_query 
(postgresql) or mysql_query and after put this result in somes 
variables, Am I using double memory to same data or this new variable 
point to variable with db result?
The postgresql or mysql process is storing the resultset in memory, php 
is passed the address of the resultset.  When you actually pull the 
individual rows out of the resultset into PHP and assign them a 
variable, you are storing a second copy of that.  If you pull out all 
the rows and store them in an array in PHP, you then have two copies of 
your entire data.  If you need to pull your whole set of results out 
into an array, you can immediately use pg_free_result() or 
mysql_free_result() afterwards to free up the copy using memory in the 
database.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


[PHP-DB] Memory

2005-04-27 Thread [FOTOList.com] Suporte
Hi,
When I get something from database, using this function: pg_query 
(postgresql) or mysql_query and after put this result in somes 
variables, Am I using double memory to same data or this new variable 
point to variable with db result?

Gustavo Paixão
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] memory leak???

2001-12-13 Thread Sommai Fongnamthip

Hi,

I have an error when try to query from 2 database (m$ sql).

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 29 bytes)

when I check my server memory it have free for a lot
  total   used   free sharedbuffers cached
Mem:126516 110996  15520  38864  38212  42192
-/+ buffers/cache:  30592  95924
Swap:96348   4848  91500

How could I fixed this problem??

SF



[PHP-DB] Memory Issues with MySQL & 4.0.6

2001-07-12 Thread Chris K. Chew

Hi.

PHP crashes every time we run a certain batch of reports since we upgraded
from 4.0.4pl1 to 4.0.6. The report is ridiculously complex and requires a
boat-load of database queries. They ran very well on the previous versions
of PHP.

Information:
--The script tanks after the 34th query, at which point it begins
displaying:
"Supplied argument is not a valid MySQL result resource."

--We have tried the script using:
*one connection for the entire script (mysql_pconnect)
*recalling mysql_pconnect() before every query without mysql_close()
*new connections for every query (mysql_connect...mysql_close)

--Same outcome with Mysql versions 3.23.39, 3.23.38 and 3.23.28

--Works perfectly well in PHP 4.04pl1, but not at all 4.06

--Debug log repeatedly contains two messages:

FATAL: erealloc(): Unable to allocate 1515870836 bytes
[Wed Jul 11 09:12:17 2001] [notice] child pid 16719 exit signal
Segmentation
fault (11)
- ---
./zend_execute.c(358) : Block 0x083FFD78 status:
zend_variables.c(62) : Actual location (location was relayed)
Beginning: OK (allocated on zend_API.c:379, 10 bytes)
End: Overflown (magic=0x2A8FCC82 instead of 0x2A8FCC84)
1 byte(s) overflown
- ---

I have tried lots of troubleshooting approaches, far too many to mention
now. I have also searched the mailing lists and bug reports and have read
documents all over the place, all to no avail. If I am being an idiot here,
let me know and I'll go away.

Thank you for your time and help,

Chris Chew


-- 
PHP Database 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]