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.
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.
03-08-2010 01:07 PM
Hi, I am using queues to perform certain file writing operations. Since my data writing rate is faster, I am enqueueing the data first and after a certain interval, I am 'Flushing' out the queue and writing the data to a file. I am performing this operation using 2 seperate loops, one loop for enqueuing and another loop for flushing.
But when I check the memory (labview execution trace toolkit), I find that that the 'memory allocation' is being done but there is no 'memory free'. And because of that, the memory size is increasing rapidly.
Could you guys plz help me out in making the memory usage stable.
I'm initializing the queue before I begin the actual logic execution and destroying the queues only after while I am exiting my application.
Looking for your answers/suggestions in anticipation.
Sreedhar
03-08-2010 02:34 PM
03-08-2010 10:40 PM
Hi, the file size isn't very large at all. I am having a condition where I am checking if the queue size is more than 60 elements and whenever it exceeds 60, I flush it out.
I do not have the code here as the code I have developed is on a remote domain (no internet). However, I will try to build a replica of it and provide it to you.
Meanwhile, can anyone still give me some pointers where I need to take care.
-Sreedhar
03-09-2010 08:51 AM
03-09-2010 10:08 AM
03-09-2010 11:35 AM
Hi Guys... thanks for your answers. However, I think I found the solution. LabVIEW keeps allocating memory upto the max size of the queue. It then starts freeing the memory. In my case, I gave the max queue size as 1000 and was flushing out as soon as the queue size exceeded 60. So, I reduced the max size to almost 100 and flush after 60.
Now when I check in the execution trace, the memory free is happening.
Hope this will be helpful to others who are stuck like me.
03-09-2010 12:00 PM
A little more mn freeing up memory.
Yes LV will keep any memory it has allocated unless we explicitly fee it up or the VI goes idle and house keeping frees the memory. But just because LV has allocated for the queue does not mean it is not available for other tasks once the queeu is flushed. THe next time the queue get filled those buffers will be used if they are available and large enough and might as well throw in "contiguous" while I am at it. Now if LV just kept allocating more without re-using the olds stuff, then we're leaking.
Ben
03-09-2010 12:15 PM
Ben, could you pl provide a better picture of what you were trying to say?? I understood the part in which you said that LV will free the memory if the VI is idle or if we clean up the memory by ourselves. But what were you trying to say with queues ?
In my case, I was initializing the queue in my constructor and destroying it while I exit the application.
So what I assume is, all the queue size was getting utilized for once and then it continuously starts freeing the memory. LV keeps on allocating whenever a new element is enqueued but also frees the memory after the flush operation.
03-09-2010 12:40 PM - edited 03-09-2010 12:41 PM
Sreedhar T wrote:Ben, could you pl provide a better picture of what you were trying to say?? I understood the part in which you said that LV will free the memory if the VI is idle or if we clean up the memory by ourselves. But what were you trying to say with queues ?
In my case, I was initializing the queue in my constructor and destroying it while I exit the application.
So what I assume is, all the queue size was getting utilized for once and then it continuously starts freeing the memory. LV keeps on allocating whenever a new element is enqueued but also frees the memory after the flush operation.
Nope.
The memory is is initialized "Allocated" when you initialize the queue with a 1000 max size (all 1000 elements are there but may have empty data) Flushing the buffer just puts empty data in the queue buffer and does not change the queue buffer size.
To free memory the buffer must be "dealocated" not "flushed" the destroy queue dealocates the buffer and releases the memory.
So when you changed the max size of your queue from 1000 elements to 100 elements you reduced the buffer size by 10x
03-09-2010 11:53 PM
But as per the labview execution trace toolkit, it is showing "memory free" after performing the flush operation. As an information, I have used the queue in an LV2G.
I will try to destroy the queue as soon as I perform the flush and see the memory difference.
Just a piece of advice that I want, would you tell me the implication on performance (CPU usage) if I use the queue destroy so often?
Thanks
Sreedhar