07-16-2015 12:33 PM
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
07-16-2015 01:02 PM
We probably would need to see some code.
07-16-2015 01:33 PM
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
07-16-2015 01:42 PM
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.)
07-16-2015 02:01 PM
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
07-16-2015 02:07 PM
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).
07-16-2015 02:13 PM - edited 07-16-2015 02:13 PM
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?
07-16-2015 02:13 PM
Hi Eric,
Truth be told its so messy right now im a little embarrassed, 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
07-16-2015 02:20 PM - edited 07-16-2015 02:23 PM
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.
07-16-2015 03:48 PM
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.