Tuesday, December 22, 2009

Fatal error: Allowed memory size of 33554432 bytes exhaustsed

when follow the Jobeet tutorial to Day 9, functional test,  got problem with the following test:
php symfony test:functional frontend
categoryActionsTest..................................................dubious
    Test returned status 139
    Failed tests: 0
jobActionsTest.......................................................dubious
    Test returned status 139
    Failed tests: 0
Failed Test                     Stat  Total   Fail  List of Failed
------------------------------------------------------------------
categoryActionsTest              139      1      1  0
jobActionsTest                   139      1      1  0
Failed 2/2 test scripts, 0.00% okay. 2/0 subtests failed, 0.00% okay.  

went further to teste the code one by one then found the fatal error:
php symfony test:functional frontend categoryActions
> 1 - The category page
>   1.1 - Categories on homepage are clickable
# get /

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) 
in /home/ddd/projects/jobeet/lib/vendor/symfony/lib/helper/PartialHelper.php on line 148

went to /etc/php5/apache2 to edit php.ini to change the memory limit to 128M then restart apache it didn't help.
went to /etc/php5/cli to edit php.ini to change the memory limit to 128M then restart apache, it only pass 3 tests then threw Segmentation fault again...

added the following in front the test code
$browser->with('response')->debug; 
and run test again, the response debug showed there were too many job records returned(about 30 jobs), that's why memory was running out?

1 comment:

Bangon Kali said...

I was having the same problem. Could we compare each other's code for reference?

I know you did this a very long time ago already, but if your codes are still there and you can still remember the detail, or if you may have fixed this problem can you at least share to me your solution?

Thanks in advance!