A P - 2009-08-25

Hi, I am having issues trying to run a nu_soap call within a for loop to upload chunks of a file (approx 1MB each) through a web service to upload files onto a remote server.

My problem is that everytime my loop iterates, the memory usage keeps increasing by approx 1MB(the file chunk data size). Is there anyways to flush out or empty whats being stored in $client, so that I can control the memory better without having to up the memory_limit in php.ini(want to avoid upping this, as I will be uploading some very large files through this method.
I have unset all other variables being used in the function.
I don't want to have to create a new instance of nusoap_client each time, as it adds quite a bit of time onto the execution time of the function.


Sample code:
//Memory Usage is normal here
$client = new  nusoap_client('http://www.example.com/upload.asmx?wsdl', true);

foreach($chunkFiles as $chunkFile)
    $ChunkParams = base64string_of_the_file_chunk;
    $result = $client->call('AppendChunk', $ChunkParams);
    //Memory usage increases at this point

//Memory Usage returns to normal here