in Education by
I tried globalising variables and undef , increasing data segment space in unix , localising variable , but still getting the same error. I need to process around 750 files .Can anyone help? Thanks. I know reading the entire file into string may be a problem. But I am not sure of anyother ways. But still as i declare the string as global and making it ="" . shoulnd tht release memory in next iterations ? foreach my $file_name (@dir_contents) { if(-f "rawdata/$file_name") { $xmlres=""; eval { while() { $xmlres.=$_; } close FILE; ***$doc=$parser->parsestring($xmlres);*** foreach my $node($doc->getElementsByTagName("nam1")) { foreach my $tnode($node->getElementsByTagName(("name2"))) { //processing } } } } } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
First of all, the style comments are useful and correct, and would help. However, if you need to process 1.5Gb of XML, you're going to need to manage memory a little bit better. XML::DOM doesn't automatically free space it used. This is a sign of its age, and newer modules manage memory much better, and tend to do this automatically (I also use XML::LibXML, which does this, and I'd also recommend it highly). Mainly, you need to call the dispose method to clean out a DOM tree when you have finished with it. This is fairly clear in the pod synopsis for XML::DOM. Just calling it may be enough to get your memory issues resolved. (Technically, DOM trees tend to contain cyclical references, and these are not automatically managed in simple referencing counting garbage collection. Perl has used weak references to assist, but it looks this hasn't been integrated in XML::DOM fully. Simply unreferencing the tree is not enough.) I'd certainly look to improve style elsewhere. Some other style issues; I'd try Try::Tiny to handle the eval {}, as you seem to be using it mainly for exception handling. Also, several bad experiences have taught me that using a solid date/time parser is always a good idea. I use the ones in DateTime::Format::*. There are many odd cases in date and time parsing, and this will save you lines of code and make the handling more reliable.

Related questions

0 votes
    Unix is very simple it just needs a genius to understand its simplicity Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    I have created a client-server program with Perl using IO::Socket::INET. I access server through CGI ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    What is the memory limit in R for 64 bit system? (a) 8 TB (b) 9TB (c) 10TB (d) 16TB The ... Functions and Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    class Modulus { public static void main(String args[]) { double a = 25.64; int b = 25; a = a % 10; b = b % 10; ... (a + + b); } } Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    Using the ______ account of a UNIX system, one can carry out administrative functions. (a) root (b) administrative ... questions and answers pdf, mcq on Cyber Security pdf,...
asked Nov 4, 2021 in Education by JackTerrance
0 votes
    I am about to build a piece of a project that will need to construct and post an XML document to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Can you arrange 9 numerals - 1, 2, 3, 4, 5, 6, 7, 8 and 9 [using each numeral just once] above and below a division line, to create a fraction equaling to 1/3 [one third]?...
asked Feb 13, 2021 in Education by JackTerrance
0 votes
    It means all points of the message should connect to each other and should be relevant to the main topic. Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    It means all points of the message should connect to each other and should be relevant to the main topic Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    Each message published to a topic is delivered to _______ within each subscribing consumer group. (1)all consumer ... (3)zero consumer instances (4)multiple consumer instances...
asked Jun 17, 2021 in Technology by JackTerrance
0 votes
    What Message Exchange Patterns (MEPs) supported by WCF? Explain each of them briefly....
asked Apr 3, 2021 in Education by JackTerrance
0 votes
    I have a question to understand the concept of ASP.NET with each client browser. I am trying to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Write a program which sends the name of a text file from the client to server and display the message on the ... file present or not. Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
...