Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$25
MemCache errors with Symfony
I run a simple query:
$c = new Criteria();
$c->add(GreenwichPeer::TEXTID, $id);
$c->add(GreenwichPeer::STATE, 'W');
$v = GreenwichPeer::doSelectOne($c, $con);and I get a MemCache error:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4 bytes) in /home/lib/MEMCACHELocalCache.class.php on line 85Our MemCache class is a simple wrapper around the MemCache class you can find on php.net.
public function Set( $key, $var, $expires=0 )
{
if( $expires < 0 ) return;
if( ! $expires ) $expires = $this->ttl;
//$exptime = time() + ($expires * 60 );
$exptime = ($expires * 60 );
// Set the cache
$key = SF_PRODUCT.'_'.strtoupper($key);
if( ! $this->cache->set( $key, $var, false, $exptime ) )
GeneralLogger::Write('LOCALMEMORYCACHE','Unable to set memcache key/value');
}
public function Get( $key )
{
$key = SF_PRODUCT.'_'.strtoupper($key);
return ( $this->cache->get( $key ) );
}Anyone else have a problem like this?
I also tried the query like this:
$criteria0 = new Criteria();
$criteria0->add(CaoContentPeer::TEXTID, $id);
$criteria1 = $c->newCriterian(CaoContentPeer::STATE, 'W');
$criteria0->addAnd($criteria1);
$v = CaoContentPeer::doSelectOne($criteria0, $con);Same problem.
This question has been answered.
marshall | 04/28/10 at 4:15pm
Edit
(7) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
04/29/10
5:32pmcasivaagustin says:open your php.ini
look for
memory_limit = 8M
change this to
memory_limit = 16M
You'll find that a few things are memory intensive, rather than processor intensive. Increasing the limit and restart apache will fix this.
Note: You need to restart Apache after making any changes to php.ini.- 04/28/10 4:22pm
casivaagustin says:open php.ini
look for
memory_limit = 8M
change this to
memory_limit = 16M
16 or More if is needed
You'll find that a few things are memory intensive, rather than processor intensive. Increasing the limit and restart apache will fix this.
Note: You need to restart Apache after making any changes to php.ini. - 04/28/10 4:27pm
casivaagustin says:open your php.ini
look for
memory_limit = 8M
change this to
memory_limit = 16M
16 or More if yo Needed.
You'll find that a few things are memory intensive, rather than processor intensive. Increasing the limit and restart apache will fix this.
Note: You need to restart Apache after making any changes to php.ini.
- 04/28/10 4:22pm
-

Last edited:
04/28/10
4:25pmEduardo Raffoul says:Usually this kind of errors are related to your server configuration. You should look for php.ini (the path depends on your sever installation, if you're using lamp, xampp, mamp, etc..)
Inside php.ini look for:
memory_limit = ...
change the value for:
memory_limit = 32M
and that should solve your problem
PS1: You usually need root grant access to change this.
PS2: You must restart your server for the new configuration to take effect -

Last edited:
04/29/10
5:32pmArturo Linares says:If you still have memory problems and you are using php 5.1 there is a bug where recursive references leaks memory:
http://bugs.php.net/bug.php?id=33595
It was fixed in PHP 5.3
- 04/29/10 5:30pm
marshall says:Thanks. This was a big part of it.
- 04/29/10 5:30pm
-

Last edited:
04/28/10
5:30pmBill Hunt says:The other posters are right, this doesn't have anything to do with Memcache; that runs outside of PHP. However, I would advise caution before increasing your memory limit willy-nilly; you probably should be debugging your query to find out why it's exceeding 8MB on a selectOne(), as you don't want to choke the server.
-

Last edited:
04/28/10
8:06pmMartin Palacio says:What is exactly the line #85?
How many records do you have in Greenwich table? Did you set the correct indexes?
Try to deactivate MemCache. How long takes the query (SQL) to execute? -

Last edited:
05/06/10
2:17pmEnder Technology says:It initially appears that the database row contains almost 32MB of data. However, we need more information regarding your setup such as how the caching layer is integrated.
Do you use the sfPropelMemcachePlugin? My other guess is that somewhere in that caching layer is attempting to retrieve/stuff almost 32MB of data.
While investigating I recommend following "mppfiles" suggestion from above to reduce the number of variables in this situation.
Rob O.
Ender Tech Corp.
www.endertech.comPrevious versions of this answer: 05/06/10 at 2:17pm
-

Last edited:
04/29/10
12:35pmAleksander Wons says:I have faced similar problem when i passed sfContext object around the app.
If You will try to serialize or unserialize sfContext object You will almost always runt into such problem.
Additionally there is not enough background to figure out why this is happening. Symfony should not use more then 16MB per instance unless You are something that consumes Your memory.
It is difficult to help when we have insufficient details.
This question has expired.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
