NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Allowed memory size of 33554432 bytes exhausted


Joined: 25 Oct 2007
Posts: 3
Reply with quote
Hello everybody,

I'm using nusoap library and this is the first time i'm working on SOAP services. I managed to create a webservice using PHP - NuSOAP library. The web service internally calls the database retrieves results and sends back.
Today i got this error while executing the code. The web service gives results when i limit my query to 3000. But i need to get all 10000 + results.

Allowed memory size of 33554432 bytes exhausted (tried to allocate 129 bytes) in server/path/lib/nusoap.php on line 809.

I checked on net and saw the solution to set the memory size to 16 mb. I tried ini_set("memory_limit","16M");
But i dont know where this function should be pasted. I tried and got error.
One more thing i used mysql_free_results function to free the memory in my code.

Please tell me setting the memory size to 16M will solve my problem or not?
Also is there any other thing i need to do?


Thanks,
Rohan7
View user's profileFind all posts by Rohan7Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
your script exhausted 32MB, by setting new limit of 16MB you can't solve the problem. You need more than 32MB, or rethink what you're doing and prehaps run smaller requests.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 25 Oct 2007
Posts: 3
Reply with quote
hi dmitri,

Thanks for the suggestion. Actually i'm quering a database and getting the results. For that i used mysql_fetch_assoc function to get associative array. I have defined the array as below.

$server->wsdl->addComplexType(
'Row',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name' =>'id','type'=>'xsd:int'),
'title' => array('name' =>'title','type'=>'xsd:string'),
'information' => array('name' =>'information','type'=>'xsd:string')
)
);

$server->wsdl->addComplexType(
'Entry',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Entry[]'))
);

$server->register(
'UdefFn',
array('inputString'=>'xsd:string'),
array('return'=>'tns:Entry'),
$NAMESPACE);

function UdefFn($inputString){
{
// Connection to database and query to database
$BigArr = array();
while($row = mysql_fetch_assoc($result))
{
array_push($BigArr, $row);
}
return $BigArr;
}

My database sometimes returns more than 10000 rows. I get 3000 entries easily. But more than that i get error.

Do i need to define the complexType differently ?
How can i achieve gettin all records?
Thanks
Rohan7
View user's profileFind all posts by Rohan7Send private message


Joined: 14 Jun 2007
Posts: 67
Reply with quote
I would break it into smaller chunks. It'll reduce the load on the server (both PHP & DB if the DB supports getting records in chunks) as well as making getting the results easier.
View user's profileFind all posts by CjungeSend private message
Fix NuSOAP memory size exhausted - change debug level to 0


Joined: 23 Sep 2009
Posts: 1
Location: Atlanta
Reply with quote
SOLUTION for memory leak with NuSOAP.

For production purposes (or if you are processing a lot of data) you just need to change your $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel variable from 9 to 0.

Depending on your version of NuSOAP, this variable definition may be located in the nusoap.php file at the top.

$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 0;

NuSoap appears to keep track of debug information by simple appending to this variable.

Good luck!
jony5
View user's profileFind all posts by jony5Send private message


Joined: 12 Dec 2009
Posts: 1
Reply with quote
I am also having the same problem configuring the memory, thanks for the help.
View user's profileFind all posts by mtsdesignssSend private message
hi


Joined: 12 Jan 2010
Posts: 2
Reply with quote
dont know where this function should be pasted. I tried and got error.
One more thing i used mysql_free_results function to free the memory in my code.
that is where i dont know too














View user's profileFind all posts by asd123Send private message
Allowed memory size of 33554432 bytes exhausted
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic