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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question to FG/Buffer allocation

Hi everyone,

 

I recently had trouble with a Program that crashed because of "not enough internal memory". Whe I posted I got the advice to check for unneeded extra buffer allocations and to use functional globals/ action engines.

At least that is how I understood it.

Currently I am trying to change my program accordingly and run into the following problems/questions:

 

I need to evaluate an Image. I use the ImageToArray Sub-VI to convert the Image, then I evaluate the Array. This gives me a 181*181 Array 90times a second (plus some others). Hence it would be nice, if the Arrays could be saved to the same location always. I attached my attempt. (Not yet finished)

I try using what I think is called a functional global or action engine. The 5 Arrays are initialised once (State = Init). In every successive call (state = Std), I don't want any of the Arrays to need any additional memory. All the data should be stored at the same location. I check this by having LabView show me the "new buffer allocations" (flashing black dots). So here is my questions:

 

1. There is always a dot flashing on the left-hand-side of the shift-register (hope the word is correct, I use the german version, sorry!). Are the Arrays actually being resaved with every iteration of the while loop? Wouldn't that ruin the whole idea of functional globals?

 

2. At the Point labeled "Position 1" I need 4 of the arrays to be 0. I am not sure wheter this is the way to go? Or should I use something else? What is fastest? And most important: In the case I used, the "new" Array is not saved to a different location but rather overwrites the old Array, doesn't it?

 

3. At "Position 2" I want the Sub-VI "ImageToArray" to save the new Array to the same place the Array of the before iteration had been saved to. However there is always a black dot flashing. So I wonder, what is happening? And what could I do to make the Sub-VI save the Array to a certain location? Or is this impossible? In other words, I look for something equivalent like passing a pointer to the Sub-VI, so it knows where to save the data to.

 

4. As I do not need the data of the before iterations, does the idea of using an action engine like this make sense at all? I came up with the idea because someone told me, that "not enough memory" ususally doesn't ,mean an overflow, but rather a fractioning of the memory. So I try to have everything always resaved to the same place, instead of deleting everything and then have new memory allocated randomly.

 

 

I hope I explained my questions well enough, if not, let me know and I'll have another try. Answers to only one of the questions are also more than welcome!

I hope I didn't undertand something involved in FGs / action engines terribly wrong. I'm still quite new to LabView...

 

Thanks for your help!

Greetings

0 Kudos
Message 1 of 2
(2,324 Views)

Hi!

 

What is the status quo in your work?

The "not enough internal memory" error is a rather typical one for IMAQ problems. There is a knowledge base article that might help you:

IMAQ Vision Not Enough Memory Error

http://digital.ni.com/public.nsf/allkb/1922FCDCE6623ABC8625735300592793?OpenDocument

Did you make sure the function you call by the Call Library Function Node does deallocate the used memory?

I would not force the array to be saved to the same location always, as memory is allocated dynamically to your RAM by MS Windows.

You can see how virtual memory is allocated for LabVIEW Threads using VMMAP by Microsoft

http://technet.microsoft.com/en-us/sysinternals/dd535533

In the attachement the functional global variable is missing. Would you attach a project with the FGV?

1. Well, the old value of the arrays are still available in the next loop iteration, that's the idea. So better say the memory is not deallocated. If the array is changed, then it has to be written again, possibly on another location in the virtual memory, if the size does not fit any more (arrays always have to be saved in one block).

2. The way in the Programme does allocate new memory every time you use it, it does not overwrite the memory. The memory is deallocatet later, but you have to test, when. If you don't want to go this way, then use the replace array subset (Teilarray ersetzen) function to overwrite the actual values by "0"

3. Don't worry about that point. LabVIEW does not use Handles or pointers. So, if you give them to a function library, they have to be created. That is the cause why there is memory allocated. The way you do it is the right way to programme pointers or handles.

4. If you do not need the data of the iterations before, then it is more simple to create a 0-Array before the loop and use a tunnel to work with it. Try both methods. But I don't think the error is about the way how the memory is allocated by LabVIEW or Windows

Greetings,

 

Stefan Egeler

Application Engineer

National Instruments Germany

 

0 Kudos
Message 2 of 2
(2,278 Views)