08-09-2012 10:34 AM
Hello,
I am using the "Call Library Property Node" in a VI to do some calculations (the calculation is done by Fortran source code which compiled as dll). Everything seems working ok except for one issue.
In my code I have an array of input with certain length, say 6 elements. I expect to get the same number of elements output from the calculation dll, which did happen the first time I run the code. Now if I increse the element of input to 8, I get 8 outputs, with no problem. However, if I now DECREASE the element of input back to 6, I still have 8 outputs displayed in the indicator! The last 2 elements actually from the previous calculation with 8 inputs. If I close the program and then reopen it, it back to normal.
Why those values are still there? It seems they are left over in somewhere. I am not sure if this is something to do with close reference? But I do not know what to close and how to close. Or do I need to clear something?
Any suggestiong would be greatly appreciated! Thanks
Rgds,
Harry
08-09-2012 10:45 AM
I think it's LabVIEW trying to save memory allocations and reusing the array. I would just use the the Array Size on your input array and use Array Subset to trim the array to the same size as the input.
08-09-2012 10:53 AM
Crossrulz,
Thanks for your reply. What you suggested is actually what I am doing it right now as a "bandage". I had memory leak problem in the past so I always try to avoid any potential issues (this code normally need to run months without interrupt at industrial site). I just want to make sure when calling the dll in loop (excutes every second), this issue won't casue any major problem.
Do you think there is any better solution to avoid this from happening? Thanks again!
Rgds
Harry
08-09-2012 11:15 AM
Not that I know of. But having LabVIEW reuse the memory is actually in your favor (it's not constantly reallocating memory, reducing your leaks).
08-09-2012 12:08 PM
Thanks. That makes sense!
08-09-2012 06:39 PM
How do you decrease the input array? A little example VI posted with your original inquiry would make such questions unneccessary! Words can describe a graphical program only in a limited way, especially if it is not your native language, and even a screen shot leaves out about 70% of possible informations.