BIG SOAP result - how to reduce memory usage

Discussion in 'PHP' started by chrille112, May 6, 2009.

  1. #1
    I'm working on a project where I recieve a big SOAP result (about 250 MB) that I need to parse. I get out of memory errors all the time - now I have set memory_limit to 1024 MB, and it does not feel good.

    
    $client = new SoapClient("http://www.example.com/soap/?WSDL", array("location"=>"http://www.example.com/soap/");
    
    $data = $client->getInfo();
    foreach($data as $row)
    {
    // do stuff
    }
    
    Code (markup):

    Any ideas how I can reduce memory usage, or at least free some while parsing data?
     
    chrille112, May 6, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    If you delete your array values as you loop through it can reduce the memory usage.

    Can you post what's in the do stuff section? It's hard to give a recommendation without knowing what the script is doing.

    However with that memory limit and a 250Mb dataset, there isn't a lot of room.
     
    jestep, May 6, 2009 IP