views:

9939

answers:

2

Hello, I currently have a set-up that goes as such:

I have a bunch of "client" point of sale systems that periodically send new sales data to one centralized "HQ", which stores the data into one big database for report generation.

The client POS is based on PHPPOS, and I have implemented a module that uses the standard XML-RPC library to send sales data to the service. The server system is built on CodeIgniter, and uses the XML-RPC and XML-RPCS libraries for the webservice component. Now whenever I send a lot of sales data (as little as, say, 50 rows from the sales table, and individual rows from sales_items pertaining to each item within the sale), I get this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 54 bytes)

128M is the default value in php.ini, but I assume that is a HUGE number to break. In fact, I have even tried setting this value to 1024M, and all it does is take a longer time to error out.

As for steps I've taken, I've tried disabling all processing on the server-side, and have rigged it to return a canned response regardless of the input, to no avail. However, I believe the problem lies in the actual sending of the data. I've even tried disabling the maximum script execution time for PHP, and it still errors out.

Hoping for a good answer, since I'm actually rushing the latest revisions for this project. Thank you for your time! :)

+1  A: 

It's very easy to get memory leaks in a PHP script - especially if you use abstraction, such as an ORM. Try using Xdebug to profile your script and find out where all that memory went.

troelskn
I'll go try Xdebug. I have never used it before, so I'll have to read up on it. Thank you for replying! Hope I find the answer to this soon...
ArcticZero
Remember that PHP uses reference counting for managing memory. So if you have circular references, or global variables, those objects won't get recycled. That's usually the root of memory leaks in PHP.
troelskn
Xdebug shows that CI's Xmlrpc.php library is responsible for my memory leak. By any chance, would there be any issues with CodeIgniter's XML-RPC libraries that I should know about? I have tried disabling all processing server-side, and it still runs out of memory if I feed it enough data.
ArcticZero
I don't know/use CI, so I don't know. But you should probably try to find an object that isn't freed up after use - most likely because of a cyclic reference. It's detective-work.
troelskn
A: 

I fixed this bug. See: http://codeigniter.com/forums/viewthread/143001/

AboBander