From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

My labview application consumes my CPU memory completly

Hi frndz...

I am using CPU with 4-GB RAM, My labview application does following things

1) It loads the an excel sheet with memory size( 5MB to 60MB)

2) Analyze the rows and columns with some formula, example avaeraging some columns, finding max value, min value, finding average by omitting 0s, some formulas, etc

3) And finally the consolidated data will be written in another excel file

 

Issues

1) This application only works for the excel files with size upto(25MB)

2) If file size goes beyond that " Not have enough memory to complete this operation" error is displayed and RAM memory utilization is upto 3.00GB

 

Observations

 

1) WHen i am developing this software, whilw working with the source code only max 5MB file i can use and test. but after building exe it is taking files upto 25 to 30 MB

2) Looking for advice in handling memory here.

 

Thanks in Advance..

0 Kudos
Message 1 of 10
(3,590 Views)

Well, it would be useful to see some code.

 

  • Is it really an excel file or just a delimited spreadsheet file?
  • Operations on big arrays can often be done very efficiently in place. But they can also be done very inefficiently when constantly reallocationg memory and having many copies of the data in memory (front panel, allocation dots, local variables, etc. etc.).  How are you "omitting 0", for example. Using "delete from array" in a tight loop would be very expensive and there are much better techniques.
  • How are you measuring "excel file with memory size"? Is this the file size on disk, the size occupied in memory, the number of data points??
  • A typical CPU does not have much ram (except for the various cache levels). I assume that your computer (not the CPU) has 4GB of RAM instead?
  • Is your OS 32 or 64bit? What is your OS (windows, mac, linux?)

4GB is not that much these days. What else is running on the computer?

0 Kudos
Message 2 of 10
(3,559 Views)

Hi altenbach

  • Is it really an excel file or just a delimited spreadsheet file?

--- Its an excel file generated from other application

  • Operations on big arrays can often be done very efficiently in place. But they can also be done very inefficiently when constantly reallocationg memory and having many copies of the data in memory (front panel, allocation dots, local variables, etc. etc.).  How are you "omitting 0", for example. Using "delete from array" in a tight loop would be very expensive and there are much better techniques.

---I am deleting it by passing every index into loop and comapare it to delete  Smiley Mad)

  • How are you measuring "excel file with memory size"? Is this the file size on disk, the size occupied in memory, the number of data points??

----Size on the Disk

  • A typical CPU does not have much ram (except for the various cache levels). I assume that your computer (not the CPU) has 4GB of RAM instead?

----Yes its Computer RAM Memory

  • Is your OS 32 or 64bit? What is your OS (windows, mac, linux?

----32-Bit Windows 7

4GB is not that much these days. What else is running on the computer?

-----I accept it, Smiley Very Happy

 

I have attached the complete Code kindly have a glance at it.

.

0 Kudos
Message 3 of 10
(3,543 Views)

How to handle memory in these kinds of situations?

0 Kudos
Message 4 of 10
(3,508 Views)

After a very quick glance, the glaring spot to me is in your Modes To Remove.  Instead of using Build Array inside of a FOR loop, use Autoindexing Tunnels.  This will prevent a lot of duplicating of memory.

 

Also, your ModeToRemove event should call the state that does the exact same thing.  No need to duplicate code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 10
(3,490 Views)

Hi Crossrulz

                Thank you for the reply, I have altered the code as per above in every part of code. And it seems works like the same. Is there anyother things u can observe apart from this. I tried doing all i know. Smiley Surprised

 

 

0 Kudos
Message 6 of 10
(3,466 Views)

@karthickkece wrote:

----32-Bit Windows 7

 


Have a look here. LabVIEW can only use 2GB of RAM in 32bit windows. You can possibly change the boot configuration to allow 3GB, but I don't think that will help you much. The solution is in efficient code.

 

(Sorry, I have not looked at your code. Not sure when I will have time....)

0 Kudos
Message 7 of 10
(3,415 Views)

OK, looking at your code...

 

What is the toplevel VI?

 

Looking at "ExcelRead.vi" and "consolidatetograph.vi":

You don't seem to understand the "request deallocation" function at all, else why would you place it inside a sequence frame?

If these subVIs typically operate on similar size data, requesting deallocation forces it to allocate the same amount of memory again on the next run while without this function it can re-use the already allocated memory, a much cheaper scenario.

 

I'll have another look later....

Message 8 of 10
(3,409 Views)

You are using "Excel" functions that I don't recognize.  Is this a third-party package to read/write Excel?  I have a fair amount of experience with the Report Generation Toolkit that NI supplies, which "hooks" into Excel and appears to be pretty efficient.

 

I just checked our Experiment machine, where we use Excel mainly to provide the hundred-or-so parameters necessary for every Experiment Trial (and there can be several hundred trials) -- most of the cells are "read-only", but we do write back into some to record, for example, how much LabVIEW (analog and Event) data we took during that trial.  We are also running Win 7 32-bit (for the life of me, I'm not sure why), but we have 8GB of memory on that PC.  [If memory is your only problem, memory is really cheap these days ...].

 

Bob Schor

0 Kudos
Message 9 of 10
(3,369 Views)

Windows 32bit cannot address more than 4GB, so 8GB would not make any difference. (See here for example)

Message 10 of 10
(3,349 Views)