function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ekennedyekennedy 

Allowed memory size of 8388608 bytes exhausted

I am using PEAR SOAP to load data into Salesforce using php.

The system works great until it tries to load about 800 records or more in one sitting, then it gets this error:

 Allowed memory size of 8388608 bytes exhausted (tried to allocate 35 bytes) in <b>/usr/share/pear/SOAP/Base.php</b> on line <b>1204</b><br />

Does anyone know if this is an error in the SOAP code or if there's anything I can do to get around this?

Thanks.
adamgadamg
This appears to be a problem with your PHP config; looks like you are running out of memory.  Check your php.ini file; you should see an entry lke "memory = 8M" (something like that); bump that up to 16 or 32M and hopefully that will do the trick.
ekennedyekennedy
I thought about doing that, actually, but it doesn't seem like this would fix the problem. I have this loader on a cron job that runs every night. if I increase the limit to 16M or 32M, what happens when I get to the next limit?

What is it in the SalesforceClient.php and SOAP code that is making this program such a memory hog? Is there any way to fix it?

Thanks again.
adamgadamg
Its hard for me to say, I but I can imagine how 1000+ rows of an object (especially if you have lots of fields) can take up a lot of space given the overhead of XML + wrapper object recreation to manage the XML.  And 16M of stack space is actually really small - take a look at what Java and .NET use!

You other option is to work with smaller batches.