‎03-23-2010 06:56 AM
Hi, I am trying to run an application having different states in it (Hybrid architecture). But I am finding that at regular intervals, the memory size is increasing by 64KB. The time is also quite periodic. I have checked each and every loop for any memory leaks or any problems but in vain.
Can someone give me any pointers of why this increase in memory is happening.
I run each loop once in every 1 sec, but the memory is increasing after every 3 minutes. I tried perfmon to check this graph.
Thanks
Sreedhar.
‎03-23-2010 07:38 AM
Sreedhar,
Can you put the code up?
Matt
‎03-23-2010 08:13 AM
Hi, Thanks for getting back. Unfortunately, I have the code on a remote network which has no internet connectivity.
However, I can try to brief out how my app is functioning:
1. There is a low level driver to obtain data from MIL 1553 Card. The driver acquires and 'enqueues' the data into a queue in every 1Sec. This has been independently tested and proved OK.
2. My application (flushes the queue) in the timeout mode and checks for any change in data. This loop runs at every 500ms.
3. If there is a change in data, the application converts the obtained data into a 2D array of string and displays on a UI (data table). The data type obtained after flush is: 1D array of Clusters having 1D array of Clusters having 3 numeric, 1 float and 1, 1D array of numeric values) (I get the top 1D array because i flush a queue)
4. After the data is displayed on the UI, the same data is queued again and after a certain queue size, the data is sent to a log VI (another VI which is launched dynamically in the initial stage) which logs data into the file.
5. Iam opening the file ref only once and keeping a check of the file size, if the size exceeds by 1MB, I am closing the file and re-opening a new file. Each new file is created in a span of 1hr and 30min. I have also checked that this closing and opening of file has nothing to do with the increase in memory. I have tested that part for quite a long period of time.
6. After completion of the logging state, the main app returns to the timeout mode and flushes the data from the queue which the driver has enqueued.
Hope I am clear.
Thanks
sreedhar.
‎03-23-2010 08:31 AM
‎03-23-2010 11:29 AM
Yes!! I have used the execution trace tool kit and also the VI profiler. There are no reference leaks and memory loss. The amount of allocation that is happening is also getting freed up. There is however some memory resize (5 to 70 bytes) happening in each loop.
Im so sorry about the constraint that I cannot post the code. However I will attempt all the methods that each one of you would recommend and answer you back.
cheers
‎03-23-2010 12:07 PM
Here's my 2c worth
Looking at the characteristics of your program, I would personally recommend you look at the timing.
your timeout is every 500ms, if due to some timing issue (the PC is running some other program like a Virus scanner or Outlook that is slowwing it down, in my experience this can affect timing issues quite a bit.
If the queue doen't get flushed what happens?
Is the 2D array out getting larger each time (uninitialised shift register)?
It's not something a simple as the MIL driver session being opened repeatedly but not being closed is it? - The number of times I've seen that with DAQ cards as the cause of a memory leak that builds up by 2bytes or so per run.
James
‎03-24-2010
04:28 AM
- last edited on
‎04-28-2025
09:42 AM
by
Content Cleaner
You can refer https://www.ni.com/docs/en-US/bundle/labview/page/vi-memory-usage.html
Regards,
Hardik
‎03-24-2010 07:50 AM
Sreedhar T wrote:...But I am finding that at regular intervals, the memory size is increasing by 64KB. The time is also quite periodic. ...
Thanks
Sreedhar.
That sounds like a ref is geting opened and closed repeatedly.
Example:
If I open, use and close a VISA ref repeatedly and start the code on Friday afternoon, by Monday I will see more momory used by LV. When i stop LV the memory will drop to where it was when I started.
So look for similar situation in your code.
If all else fails start throwing away code until the problem goes away. Then look back at the last thing tossed.
Ben
‎03-24-2010 08:46 AM
‎03-24-2010
09:05 AM
- last edited on
‎04-28-2025
09:42 AM
by
Content Cleaner
@Ben: Yes, as I am continuously logging the 2D data into a file, I am opening the file ref at the initilization (executes only once) and continuously checking the size. As soon as the file size is greater than 1MB, I am moving the file into an Archive folder by attaching a time stamp to the file name. In the process I am creating a new file and again checking the size. The archive typically is happening at about every 1Hr 30Min, whereas the size is increasing typically at about every 50Min. Each time it is 64KB.
@Mark: I am appending the 2D array untill it has reached 1000 elements. Then, I am deleting the first rows and appending new at the bottom. The data scrolls by then on at the rate of every 1 sec. This logic was a bit difficult for me to implement as this runs as many times as my loop iterates. However, I have tried to run this by using dummy data seperately. I saw that the memory increases as long as the 2D array reaches to its peak (1000 elements), then it remains steady. I have tried running it for more than 24 Hrs and it seems to quite stable.
I read the following link below and tried using it for a couple of hours. Currently and it appears to be doing good for me too... I have set for an overnight test today, will analyze the results tomorrow and let you all know:
Cheers