LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak Issues

Hi All,

 

I currently have an application that aqcuires thermocouple data, a maximum of 16 channels, and writes it to a waveform chart and a table on the front panel.  Every 2k samples i reinitialize the table, but i would like the chart to display every sample, at most 25k.  Ive been observing the resource monitor and i am able to watch the commit, private, and working bytes increase.  The commit bytes are increasing at a minimum of 1KB per sample taken.  Is this something that is common when writing to a table or large waveform chart, or is there an obvious memory leak?

 

Thank you,

 

Matt



-Matt
0 Kudos
Message 1 of 12
(3,723 Views)

We probably would need to see some code.

0 Kudos
Message 2 of 12
(3,702 Views)

Altenbach,


Im in the process of cleaning it up a little, ts a bit out of control, and then i can post.  But are there common functions that can cause the commit bytes to increase?  Such as writing to tables and charts or shift registers possibly? I guess my question is if that is common to see an increase like that? I dont think it will cuase in issue becuase the duration of the test is short, but i would like to know.

 

Thanks,

 

Matt



-Matt
0 Kudos
Message 3 of 12
(3,680 Views)

Well, are you constantly resizing data structures? remember that arrays are contiguous in memory, so constant resizing will cause frequent reallocations and memory fragmentation. Also LabVIEW is relatively lazy deallocation memory, because it might use it again soon.

 

What is the history size of the chart?

 

Are you really writing 2k entries to a table? How much of it can you actually see? Where else is the same data (or it's numerical representation) kept (shift registers, etc.).  What do you mean by "initializing" (resizing to zero size or replacing all existing element by empty strings, keeping the size constant.)

 

 

0 Kudos
Message 4 of 12
(3,669 Views)

Altenbach,

 

I write more than 2k samples to the chart but every 2k sampels i replace the array built with the shift register with an array constant and index to the top of the table. So the table starts from the beginning again.  I can see only 50 samples, but i have a scroll bar.  I wanted that functionality, but i can reduce the amount of visible data points. Any suggestions on a stable length that a chart should be?  Also, i attached an image of the array functions that are happening.

 

Thanks,

 

Matt



-Matt
0 Kudos
Message 5 of 12
(3,648 Views)

Matt - it would be helpful to post the VI. That way we don't have to re-write the code you already have (unless it is proprietary).

0 Kudos
Message 6 of 12
(3,631 Views)

Well, two "insert into array" in sequence tell me that you are constantly resizing data structures. You should use a fixed size 2D array and substitute empty strings or values usign "replace array subset". Hard to tell more without seeing the rest of the code. How many rows are there? How many columns?

 

0 Kudos
Message 7 of 12
(3,623 Views)

Hi Eric,

 

Truth be told its so messy right now im a little embarrassedSmiley LOL, but ive attached the project. Ive still got a ways to go before im any good at this stuff so tear it apart.

 

Thanks for any help,

 

Matt



-Matt
0 Kudos
Message 8 of 12
(3,621 Views)

Whoa. That's a whole lof of code.

 

I'd advise a total rewrite of your code. Based on what I see, a state machine would suit you well. They are pretty easy to implement and are very flexable. Take a look at the examples that ship with Labview. I've used them on quite a bit of projects. If you need to transfer data, take a look at the Producer/Consumer examples. I use them with the state machine architecture if Ineed to pass data to a database or a text file.

 

I see that your using TDMS which may work with a state machine but I've never had to use them...yet.

Message 9 of 12
(3,611 Views)

I am using a state machine in the code, just not that well.  It needs to be reorginized i agree.  Ive actually been looking for some very well layed out examples of large vi's but havent been able to find them.  I think i will reorginize and then go from there.  I will also see what i can do about resizing those arrays properly altenbach. 



-Matt
0 Kudos
Message 10 of 12
(3,528 Views)