473,724 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory allocation question with NuSOAP and XML parsing

I have a memory allocation problem in PHP using NuSOAP and the built in XML
parser. The code below is called in a loop and executed about 1900 times
before it failed. I am using nusoap.php,v 1.76 2004/06/25 13:17:56 snichol
Exp $. I am running PHP version 4.2.2 on RedHat 9.0

I presume I need to unallocated something other than the soapclient, but I'm
nor sure what. This is the code that is called in the loop and the error
message is below. I only needed it to execute another 240 times, but my
data set will continue to grow and the total times this may need to execute
in the future will grow.

Sorry for the large post, but I wanted to show as much as I thought would be
required to provide guidance.

Thank you,

Mark C

=============== =============== =============== =============== =============== =

// Define new object and specify location of wsdl file.

$soapclient = new
soapclient('htt p://weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.p hp')

// Output any error conditions from creating the client

$err = $soapclient->getError();

if ($err)

return 0;

// call the method and get the result.

$result =
$soapclient->call('NDFDgen' ,$parameters,'u ri:DWMLgen','ur i:DWMLgen/NDFDgen')

// Processes any SOAP fault information we get back from the server

if ($soapclient->fault)

return 0;

// Capture any client errors

$err = $soapclient->getError();

if ($err)

return 0;

// Parse the resulting XML from the SOAP service ($result)

$xmlParser = createParser();

setOptions($xml Parser);

setHandlers($xm lParser);

parse($xmlParse r, $result);

freeParser($xml Parser);

unset($soapclie nt); // Unallocate object


function createParser()
$xmlParser = xml_parser_crea te();
if ($xmlParser == false)
die('Cannot create an XML parser handle.');
return $xmlParser;

function setOptions($xml Parser)
xml_parser_set_ option($xmlPars er, XML_OPTION_CASE _FOLDING, false);

function setHandlers($xm lParser)
xml_set_element _handler($xmlPa rser, 'handleBeginTag ', 'handleEndTag') ;
xml_set_charact er_data_handler ($xmlParser, 'HandleCharacte rData');

function parse($xmlParse r, $xmlOut)
$parsedOkay = xml_parse($xmlP arser, $xmlOut);

if ( ! $paredOkay && xml_get_error_c ode($xmlParser) != XML_ERROR_NONE)
die('xmlParse error: ' . xml_error_strin g(xml_get_erro_ code($xmlParser )) .
' at line ' . xml_get_current _line_number($x mlParser));

function freeParser($xml Parser)
$freeOkay = xml_parser_free ($xmlParser);

if( ! $freeOkay)
die('You did not pass a proper XML pareser to this function.');

=============== =============== =============== =============== =============== =

[mark@www v2]$ time php SanityCheck.php

X-Powered-By: PHP/4.2.2

Content-type: text/html

<br />

<b>Fatal error</b>: Allowed memory size of 8388608 bytes exhausted (tried
to al

locate 9007 bytes) in <b>/usr/share/SOAP/nusoap.php</b> on line
<b>5023</b><br /

real 33m22.071s

user 6m56.890s

sys 0m2.800s

Jul 17 '05 #1
5 5386
Mark C wrote:
Exp $. I am running PHP version 4.2.2 on RedHat 9.0

Why such an old PHP version ?

Jul 17 '05 #2
I haven't had any reason to update it, yet.
"JAS" <du************ *@gmail.com> wrote in message
news:41******** **@newspeer2.td s.net...
Mark C wrote:
Exp $. I am running PHP version 4.2.2 on RedHat 9.0

Why such an old PHP version ?


Jul 17 '05 #3
Am I wrong thinking you should just increase the memory_limit setting in
php.ini from the default 8M to something bigger ?

Jul 17 '05 #4
I could do that but that seems like hiding the real problem. If I have to I
have considered that option.

"Pjotr Wedersteers" <pj***@wederste ers.com> wrote in message
news:41******** *************** @news.xs4all.nl ...
Am I wrong thinking you should just increase the memory_limit setting in
php.ini from the default 8M to something bigger ?


Jul 17 '05 #5
Mark C wrote:
I could do that but that seems like hiding the real problem. If I
have to I have considered that option.


Could be indeed. Did you debug the script and check the sizes of all the
objects created/instantiated during loop ? I did not study your example in
detail, so not sure whether you really leak memory at some point or just
have a lot of data during the process.
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Unbreakable | last post by:
I am using the nusoap client and nusoap server without any problem. However, once I change the client to the excel, I am not sure how to call the nusoap server. Especially the nusoap server only generate the a SOAP message as follow instead of a WSDL file. So, my question is 1.) Can I use excel or .Net as a client to call the nusoap server?
by: Ward G | last post by:
Hi, Below is a basic webservice using the NuSOAP class. When I run the code to register the service, I get the nice html page generated by nusoap, offering a link to view the WSDL for my service. When I click it, php barfs this : Cannot modify header information - headers already sent by \nusoap.php on line 2421.
by: dough | last post by:
Heres a snippet of my code. I am trying to dynamically allocate memory for reading in strings from a file. FILE *f; /* file to read */ char *s; /* string being read */ f = "somefile.txt"; s = malloc(sizeof(char*)); /* allocates mem of string */ while( fscanf(f, "%s", s) != EOF ) { /* read from FILE */
by: Gary Townsend | last post by:
I am writing an app in vb .net that will use an XML webservice written in PHP NuSoap. I want to have the NuSoap server send a dataset to my VB .NET application i am trying to find any documentation of anyone pullling data from a database in PHP then using NuSoap to send it to a .NET application and have the .NET proxy class recognize the return datatype as a dataset so that i can cache the dataset on the desktop application. Gary...
by: Pedro Graca | last post by:
I have a file with different ways to write numbers ---- 8< (cut) -------- 0: zero, zilch,, nada, ,,,, empty , void, oh 1: one 7: seven 2: two, too ---- >8 -------------- I wanted to read that file and put it into dynamic memory, like
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of each object within my JS app to help locate my problem? Thanks
by: ivan.leben | last post by:
How can I really delete a preloaded image from memory/disk cache? Let's say I preload an image by creating an Image object and setting its src attribute to desired URL: var img = new Image(); img.src = ; Then I use the image a few more times by adding it into an Array object:
by: Ken | last post by:
In C programming, I want to know in what situations we should use static memory allocation instead of dynamic memory allocation. My understanding is that static memory allocation like using array is faster than malloc, but dynamic memory allocation is more flexible. Please comment... thanks.
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was compiled and run without any erros but the second program has a run time error when the function return from allocate and the ptr become NULL. How to fixed this? Second Program: /* Best Method to allocate memory for 2D Array because it's ...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.