473,796 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

perl memory usage

1 New Member
Hello,

This is really a reply to
http://www.thescripts. com/forum/thread50187.htm l

I have a script that reads in a bunch of data from txt files, then does a bunch of calculations, and outputs other txt files. I've got about 7 input txt files, each of which is 14 - 17 MB. If I open Windows Task Manager's process list I can watch Perl using increasing amounts of memory as it reads in the txt files until it chokes, at about 1.7GB (I have 2GB on my machine), which is about the 6th input txt file.

Below is a typical code block showing how I'm reading in data. Can anybody suggest a way to do the same thing without using as much memory? If not, what's the easiest way for me to tell what in my script is taking all the memory? Any help is greatly appreciated.

Expand|Select|Wrap|Line Numbers
  1. open TRAIL_FILE, "perl-inputs/fire_trails.asc.txt";
  2. my $counter = 0;
  3. while (<TRAIL_FILE>) {
  4.    chomp;
  5.    @{$trail_lines{$counter}} = split /\s+/,$_;
  6.    $counter++;
  7. }
  8. close TRAIL_FILE;
  9.  
  10. for (my $row = 6; $row < $nrows+6; $row++) {
  11.     for (my $col = 0; $col < $ncols; $col++) {
  12.         $trails{$row}{$col} = @{$trail_lines{$row}}[$col];
  13.     } # close for on $col
  14. } # close for on $row
  15.  
Feb 7 '08 #1
2 2664
WinblowsME
58 New Member
Can anybody suggest a way to do the same thing without using as much memory? If not, what's the easiest way for me to tell what in my script is taking all the memory?
All your memory is being used up because you're storing all the information you're reading. What does your data look like?
Feb 7 '08 #2
KevinADC
4,059 Recognized Expert Specialist
Its the data you read into %trails (or whatever your data structure is) that is taking up memory. Maybe if you explain what you are doing someone can suggest a different way that might save memory.
Feb 7 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6769
by: James B. | last post by:
I have written a perl script to parse some large flat-text logs. The logs are bzipped and come in through a pipe to STDIN. The script then performs some regular expressions to the incoming data then prints to STDOUT. The script works great, but the issue I have is that the script uses as much memory as the data coming into it. Therefore if I pipe a 800MB file into it, the memory usage grows and grows until it reaches approximatly 800MB,...
8
6507
by: Dan | last post by:
Using XML::Simple in perl is extreemly slow to parse big XML files (can be up to 250M, taking ~1h). How can I increase my performance / reduce my memory usage? Is SAX the way forward?
2
460
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting the app I load some things into memory for global use of the app but I'll use only 2 starting forms to explain the situation) situation 1 start app with form 1 (72mb memory usage), show form 2 and hide form 1 (89 mb memory usage
6
3279
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that, no memory is lying around. GC reports only 84k of allocations. Starting 5-10 of this apps is going to start taking a considerable amount of memory. Is there a way to reduce this? Tom
3
4152
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database periodically. What happens, is that the app reads the contents of a text file line by line into an ArrayList. Each element of the ArrayList is a string representing a record from the file. The ArrayList is then processed, and the arraylist goes out of...
0
3582
by: cmartins | last post by:
Hi All! I have a perl script which uses these modules: ProcessAdapter.pl use File::Copy; use FileHandle; use Class::Struct;
1
1462
by: tarunjindal | last post by:
Hi I am Tarun Jindal a s/w engineer working in Satyam computers I would like to ask some question from you. We at Satyam is developing a software which will built xml for out clients. We had developed software in Perl but we are experiencing performance hit.
1
2050
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after the objects for which that memory was allocated are no longer live in the process. This is only a leak if peak memory goes up again each time you create any new objects. Try repeated allocations of a large dictionary and observe how memory...
223
7394
by: Pilcrow | last post by:
Given that UNIX, including networking, is almost entirely coded in C, how come so many things are almost impossible in ordinary C? Examples: Network and internet access, access to UNIX interprocess controls and communication, locale determination, EBCDIC/ASCII discrimination, etc. Almost all of these are easy in Perl. Why isn't there a mechanism like perl modules to allow easy extentions for facilities like these? Isn't anyone working...
0
10467
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...
0
10244
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 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...
1
10201
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
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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...
1
7558
isladogs
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...
0
5454
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...
1
4130
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
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.