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
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.
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!
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).
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.