I know the way releasing the memory used by charts ang graphs is to connect an empty array to a specific property node:
"History", in the case of charts, and "Value", in the case of graphs.
How ever I would like to share a strange behavior I have witnessed in my application. I have different graphs where I load data stored in a TDMS file (approx. 40 MB size). The file is expected to be even bigger.
Before loading the information from the file the task manager of windows shows that my LabVIEW application (.exe generated with the application builder) uses 24.692 KB. the strange occurs after loading the data:
1. The first time I load the data my application increases the memory consuption up to 404.640 KB. I assign the empty arrays to clean the memory and then the size is reduced to 170.076 KB.
2. The second time I load the data my application increases the memory consuption up to 405.696 KB. I assign the empty arrays to clean the memory and then the size is reduced to 234.488 KB.
3. The third time I load the data my application increases the memory consuption up to 470.056 KB. I assign the empty arrays to clean the memory and then the size is reduced to 234.524 KB.
After assigning the empy arrays I would expect to get a memory consumption similar to the original (24.692 KB).
I am reading the TDMS file and closing it with the appropriate VIs.
Is this an expected behavior of LabVIEW or should I worry about the excesive memory usage increment?
Any information is highly appreciated,
20 years ago, 1 KB of excess data usage might have been an issue. You're talking KBs and not GBs. You're fine.
thanks for the reply.
I am concerned because my application initially require 20 MB to work and after loading the data and then cleaning the graphs it requires almost 200MB. It is 10 times the original required memory.
It does not look reliable to me if I am supposed to load bigger volumes of data.
Sorry for the vague response. What's causing this is probably that the TDMS vi's are being loaded into memory the first time that they are called and they are staying in memory. I wouldn't worry too much unless it really grows out of hand, assuming you are in fact closing everything properly.
Are you sure your math is correct?
You are now talking about 200 MB, but the data in your numbered list is only 100+ to 470 KB.
You talk about charts and later about graphs. Can you be more specific?
You talk about 40MB of data, but your memory use is less than a MB. What is the chart history size? You seem to be loading more than the chart can store at once.
I would expect chart buffers (even if currently empty) to allocate the full history size at program start (or even load time) because it is almost 100% certain that that memory will be ultimately needed. Having to allocate more chart memory at runtime would introduce jitter and is much more expensive.
Can you attach a simple program and then tell us how to use it to demonstrate your perceived memory issues.
Thank you for the reply !
I am talking only about charts. Sorry if I was not clear.
Initially the task manager reports 24.694 KB (24 MB). I load the data to the graphs and the task manager reports 404.640 KB (404 MB). Finally I assign the empty arrays to the graph to release the memory and the task manager reports 170.076 KB (170 MB). This happens the first time I perform the loading and cleaning process.
After repeating the process for the third time I finally get a reported size of 234.524 KB (234 MB).
Thanks for the help.
In addition to what was siad previously, there is also the "un-do" buffer that requires memory.
The only way you can un-load all of the memory is to invoke a VI to do the display and then completely unload it from memory using the "deallocate" node at the end. This will only work if the VI is completely unloaded. If any part of your application includes the VI in its hiearchy the VI will stay in memory and its resource will be retained.
Additionally to reinforce what Christian was saying...
This is NOT a bug and is intended. Allocating memory requires the OS switch to kernal mode to allocate and map the memory. While in Kernal nothing else can happen. LV manages memory for us. While the memory is still allocated the LV process, parts if not all are available to be used by LV to meet stoarge needs.
Just my 2 cents,
sorry for the delay of this answer. I was out of the office for one week.
I also must apologize because I made a mistake in a previous post of mine: I clarified on my post of 08-25-2016 11:13 AM (post number 7), that I was using charts. Sorry by my confusion, but I really meaned Graphs.
For this reason I cannot define a history lenght property.