473,802 Members | 1,937 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 5389
JAS
Mark C wrote:
Exp $. I am running PHP version 4.2.2 on RedHat 9.0


Why such an old PHP version ?

J
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 ?

J

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 ?

HTH
Pjotr
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.

Mark
"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 ?

HTH
Pjotr

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.

Mark


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

0
2382
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?
0
2969
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.
6
3443
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 */
2
5567
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...
16
2335
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
8
8557
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
62
17865
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:
24
19098
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.
1
7979
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 ...
0
9699
marktang
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...
0
10538
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10285
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,...
0
9115
agi2029
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...
0
6838
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();...
0
5494
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...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
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
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.