CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 PHP Error

Print topic Send  topic

Author Message
gulam

Posts: 55
Posted: 08/20/2012, 9:18 AM

Hi,

I have a program in CCS4.3 that reads statement data from a remote database (member and contribution table) and displays this info to an authenticated member. This code was working perfectly all this time, until now I am getting the error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 37 bytes) in /home/xyz/public_html/scripts/Classes.php on line 2664

Below is an extract from classes.php

2659 function GetAsArray() {
2660 $arr = array();
2661 foreach ($this->Objects as $Name => $Value) {
2662 $arr[$Name] = array($this->Objects[$Name]->GetValue(), $this->Objects[$Name]->GetText(), $this->Objects[$Name]->DataType, $this->Objects[$Name]->Format);
2663 }
2664 $arr["."] = $this->Prefix;
2665 return $arr;
2666 }

My PHP.ini has 128M set as allowed memory size, which I believe should be more than sufficient for running this.

Can someone guide me on what could have gone wrong and how do I go about debugging/solving this issue? The only thing that's probably changed is the size of the database, could this be the cause?

Thanks in advance.

Gulam
View profile  Send private message
DataDoIT
Posted: 08/20/2012, 10:12 AM

134217728 bytes is greater than 128M.

Look at your custom code and see where you can free up any variables or
arrays after you're done with them.

Ex:
unset($arr);
gulam

Posts: 55
Posted: 08/20/2012, 10:30 AM

Thanks, my php.ini is set at 128M, its probably using slightly more than that.

I don't have any custom events that are using any arrays and I can't see any variable that could be causing this issue.

The code where this problem happens is auto generated by CCS, where do you suggest I put the unset?

Also, I am using PHP 5.2, does 5.3 have better memory management? The other thing that maybe causing this is the size of the DB, it has over 20M records, but I have tested this when it had the same number of records just few days ago.

Any hints?

Gulam

View profile  Send private message
DataDoIT
Posted: 08/20/2012, 2:37 PM

Make sure you're using LIMIT/TOP in your connection settings, and/or
have a setting for Maximum Page Size in your grid.

The grid that's being built is running out of memory. I certainly
wouldn't recommend retrieving 20M records. Limit that down somehow.
bannedone


Posts: 273
Posted: 08/20/2012, 5:15 PM

Hi

here are some things to consider.

You could add this somewhere that executes early like the bottom of Common.php

ini_set('memory_limit', '-1'); //overrides the default PHP memory limit.

Of course this will not solve the problem unless your application, for some reason, actuctually needs all that memory.

If you have not added any custom code, I am suprised CCS code would cause this.

You could try Xdebug to profile your script and determin what is causing the issue.

_________________
John Real
CodeCharge Studio Support, Training, Consulting, Development, Web based solutions
http://realsites.biz
http://ccselite.com
Other Banned IDs on this Forum. jjrjr1, jjrjr2
View profile  Send private message
gulam

Posts: 55
Posted: 08/21/2012, 1:13 PM

Hi,

Thanks for your reply.

I have custom code that tries to check whether the member exists or not but the script does not even reach there. I put an echo statement before my code and it didn't get there, which means CCS seems to be doing this.

When I increase the memory from 128M to 150M then it works for sometime before it fails again. This means there is some variable somewhere that is not getting unset.

How do I go about finding this?

Gulam
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 08/21/2012, 3:40 PM

My understanding of PHP variables in general is that the PHP garbage collector releases them after they have been used within a database connection, and that global variables which have been manually created should be unset. I am pretty sure CCS is supposed to unset any global variable that it creates once it is no longer needed, unless specified not to.

_________________
Central Coast, NSW, Australia.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.