473,396 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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('http://weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php')
;

// 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,'uri:DWMLgen','uri:DWM Lgen/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($xmlParser);

setHandlers($xmlParser);

parse($xmlParser, $result);

freeParser($xmlParser);

unset($soapclient); // Unallocate object

.....

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

function setOptions($xmlParser)
{
xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, false);
}

function setHandlers($xmlParser)
{
xml_set_element_handler($xmlParser, 'handleBeginTag', 'handleEndTag');
xml_set_character_data_handler($xmlParser, 'HandleCharacterData');
}

function parse($xmlParser, $xmlOut)
{
$parsedOkay = xml_parse($xmlParser, $xmlOut);

if ( ! $paredOkay && xml_get_error_code($xmlParser) != XML_ERROR_NONE)
{
die('xmlParse error: ' . xml_error_string(xml_get_erro_code($xmlParser)) .
' at line ' . xml_get_current_line_number($xmlParser));
}
}

function freeParser($xmlParser)
{
$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 5362
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.tds.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***@wedersteers.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
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...
0
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...
6
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; ...
2
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...
16
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 -------------- ...
8
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...
62
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();...
24
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...
1
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
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...
0
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...

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.