Fatal error: Allowed memory size...
13 posts by 3 authors in: Forums > CMS Builder
Last Post: June 7, 2010 (RSS)
By eduran582 - May 14, 2010 - edited: May 14, 2010
"Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes) in /home/content/a/c/s/acsocitations/html/cmsAdmin/lib/viewer_functions.php on line 398"
I searched the forum and saw a couple of the same issue but they were all with older versions that seemed to update code that prevented this from happing (I currently have the latest: v2.04 running).
The page I'm trying to load is a simple 'search' page with only 37 total lines of code. The php code at the top (before the html) is as follows:
<?php header('Content-type: text/html; charset=utf-8');
require_once "/home/content/a/c/s/acsocitations/html/cmsAdmin/lib/viewer_functions.php";
list($citationsRecords, $citationsMetaData) = getRecords(array(
'tableName' => 'citations',
'loadUploads' => '0',
));
date_default_timezone_set ("America/Los_Angeles");
?>
The (main) html code is as follows:
<body>
<div align="center">
<font face="Tahoma" color="#8B0000" size="5">Search for Citation</font><br/><br/>
<form method="POST" action="citationsListViewer.php">
<input type="text" name="title,last_name,vehicle_license_or_vin_keyword" value="" style="text-transform: uppercase">
<input type="submit" name="submit" value="Search"><br/>
</form><br/>
<font color="#800000"><b>Total Records: <?php echo number_format($citationsMetaData['totalRecords'],0,'.',','); ?></b></font><br/><br/>
<font size="2">Today is: <b><?php echo date("M j, Y"); ?></b></font><br/>
</div>
</body>
When ALL the records are listed, this error does not come up. Anyone have an idea of what I can do?
Thanks!
Eric
NOTE: the php code has been edited from original post as after upgrading to v2.04, I noticed it said v1.35! I have since went back to v2.03. I'll be submitting another post on that.
Re: [eduran582] Fatal error: Allowed memory size...
By Jason - May 14, 2010
Could you provide a link to where you're having the trouble so I can take a look?
Thanks.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Fatal error: Allowed memory size...
By eduran582 - May 14, 2010
Re: [eduran582] Fatal error: Allowed memory size...
By Jason - May 14, 2010
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [eduran582] Fatal error: Allowed memory size...
By Jason - May 17, 2010
I located our problem.
The function getRecords has an option called 'loadCreatedBy'. This loads a record from the User Accounts table for each record returned. By default, this is set to on. Since we're loading so many records, I changed the option to off:
'loadCreatedBy' =>false,
This seems to have taken care of the problem.
Let me know if you run into any more issues.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Fatal error: Allowed memory size...
By eduran582 - May 19, 2010
Re: [Jason] Fatal error: Allowed memory size...
By mark99 - May 19, 2010
Re: [mark99] Fatal error: Allowed memory size...
By Jason - May 19, 2010
This just pulls in information from the user account table for the person who created an individual record. You could always turn it off for pages that don't require this information.
You may not really see any change in performance since the number of records most pages return is fairly small. The only reason it was an issue in this case is that the page was returning well over 12,000 records.
Hope this helps.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Fatal error: Allowed memory size...
By mark99 - May 20, 2010 - edited: May 20, 2010
Do I assume that to do this you'd just add the line like so..
<?php
require_once "lib/viewer_functions.php";
list($isp_listRecords, $isp_listMetaData) = getRecords(array(
'tableName' => 'isp_list',
'perPage' => '3',
'loadCreatedBy' => 'false',
));
?>
Or must it be 'loadCreatedBy' => false, without the ' character?
Re: [mark99] Fatal error: Allowed memory size...
By Jason - May 20, 2010
You should leave out the ' ', so it would look like this:
<?php
require_once "lib/viewer_functions.php";
list($isp_listRecords, $isp_listMetaData) = getRecords(array(
'tableName' => 'isp_list',
'perPage' => '3',
'loadCreatedBy' => false,
));
?>
That should do it. Let me know if you run into any issues.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/