LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leak

 
I´m having problems with memory leak, running my aplication in a touch panel pc. I´m using Labview 8.2 and pda module 8.2.
I followed the recomendations in "Optimizing Labview Embedded Applications" (tut_3747) but I couldn´t stop the memory leaking.
Because of that I post a vi as an example. When i run it, I get an increment of memory about 7Kb by minute, any idea about what is going on?
 
Thank you and sorry for my english,
 
Juanjo 
0 Kudos
Message 1 of 12
(11,302 Views)
Highlighted

Hi,

It may be an issue that the calculation VI is creating a new array each time it is executed.  This can be an issue on RT systems and possibly on a PDA as well.  I made a few simple changes to the calculation VI and your VI to use shift registers so that the arrays can reuse the allocated space instead of reallocating new memory after each iteration.  Hopefully, you will see an improvement.  (sorry the diagram is so messy)

Good luck,

Mike

Message 2 of 12
(11,269 Views)
Mike,
 
I tested the vi you have posted, following your recomendations, but the result was the same.
In order to initialize the array, I executes the vi, first in my pc to get an array of the same size that I would need. Then I created a costant array.
 
Thank You for your time,
 
Juanjo
0 Kudos
Message 3 of 12
(11,249 Views)

Hi,

Well that is unfortunate that it did not resolve the issue.  Here are a few more questions:

  • When you say that the memory is increasing ==> does it ever stabalize or does it increase indefinately until the system shuts down?
  • Are you building this an application or are you using it in development mode.  If you have not tried building it and executing it, you may get a different result.
  • Can you include the "PDA Memory VI" that you are using in this post?  I do not have PDA installed on my machine currently.

Thanks,

Mike

Message 4 of 12
(11,116 Views)
Mike,
 
Question: When you say that the memory is increasing ==> does it ever stabalize or does it increase indefinately until the system shuts down?
Answer: I have probed that with the full aplication not with the example we are talking about. It runs tree days an then apeared a message: "App Failed, Unable to allocate memory" , and the memory was near full.
Question: Are you building this an application or are you using it in development mode.  If you have not tried building it and executing it, you may get a different result.
Answer: I`m building the application, then, download the .exe file to the pda and execute it.
Question: Can you include the "PDA Memory VI" that you are using in this post?  I do not have PDA installed on my machine currently
Answer: I attached the vi you are asking, but it is password protected by NI.
 
Tank You,
 
Juanjo
 
0 Kudos
Message 5 of 12
(11,091 Views)

Hi,

Wow, there seems to be another issue that is causing this problem other than your memory management. At this point, I can give you some things to try but they would only be troubleshooting ideas to help you locate the problem. 

Troubleshooting Ideas ( try only one at a time and see if it makes a difference)

  • Remove the reference to the Local Variable ==> use a shift register instead
  • Remove the array indicator ==> LV PDA may be wrongly allocating new memory in the UI thread each time this indicator is written to.
  • There may be an issue inside of the DLL that the Spline Function utilizes.  Try using the Spline Pt by Pt if at all possible to see if this makes a difference.  I assume that it would not because it appears to use the same DLL but it allocates the memory in a queue instead.

Other than these tips, we will have to see if NI can reproduce this issue and provide more details.

Good luck,

Mike

Message 6 of 12
(11,008 Views)

Mike,

We made a consoult in NI, and because of a link they send to me "LabVIEW 8.2.1 Touch Panel Module for Windows CE Known Issues" -- Changes from 8.2
  a.. Reentrant Call Library Nodes no longer produce memory leaks.

I decide to unistall everithing (Labview TPC and PDA modul) and install the new version, Labview 8.2.1 and Touch Panel Modul 8.2.1. Then I run my application for about 15hs. and the program memory stabilized in 7344K. I also proved whith the example vi with the same resoult, so I guess my problem is solved.

Thank You for your help,

Juanjo

0 Kudos
Message 7 of 12
(10,729 Views)

Fantastic!  I am glad that you were able to get it to work.

Also, thank you for posting the information about the issue and what NI did to resolve it. 

Thanks,

Mike

Message 8 of 12
(10,710 Views)

I have my 0,02$ about this big unsolved problem.

 

See the my attachment code which in every call of subvi1 task manager is showing growth on 8...12 KB. No external dlls, no ODBC, no TCP, almost nothing - but growth is!

 

If I correctly do it this code than why I see the growth?

 

Moreover I want to ask for a long time is anybody here who did big projects which worked in 24/7 mode at least 6 months???

 

I often remember words of my old colleague that said simply: LabVIEW is only for students and for learning of programming (again for students) and 8/5 applications only, 24/7 projects necessary to do only under *NIX OSes and only C language or similar to it where every bit is under control. Even something I think that really at this forum one such inveterate students-veterans sit. Excuse me.

0 Kudos
Message 9 of 12
(639 Views)

Current93, your code doesn't leak. You allocate new and more memory every time, that's why it grows. 

 

In C it'd be similar to:

int *wHandler;

wHandler = new int; 

wHandler.open;

...

wHandler.close; 

 

If you do that every time you'll get a new int* every time. Just like your program shows.

 

/Y 

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 12
(632 Views)