09-14-2005 09:48 AM
09-14-2005 09:56 AM
09-14-2005 12:19 PM
09-15-2005 02:41 AM
09-15-2005 07:35 AM
Thank you. That clears it up quite a bit.
Paul
09-15-2005 08:03 AM
Labview is a managed memory language which makes programming very easy but you do loose some fine control over the process. An analogy:
Imagine used memory like garbage. You place the trash (no longer needed allocated memory) on the curb every night, in an unmanaged system this will build up until there is no more space on the curb (out of memory error/slow system response/ crashes). In c++ and other unmanaged languages when you allocate memory you must explicitly free it, memory is a finite resource so if you use a lot of make sure you return it. So in an unmanaged system you must take the garbage to the local dump (deallocate used memory), this is a tedious task best left up to a trash collection service. This is where managed systems like labview (java and c# do this but LV did it many years before it became cool to be managed). Labview has a garbage service which will periodically pick up your trash so it doesn't build up. So you wonder "Why request deallocation?". Lets say you had a party last weekend and you have 10 huge bags of garbage which you put on the curb. Garbage services don't come till Wednesday, so you call up for a special pickup to collect the excess trash. I use the request deallocation for the same instances: a subvi which uses a huge amount (large arrays) for temporary processing and are called often, you can deallocate memory after such calls explicitly. If you notice that your application seems to slow after many repeated calls, it can help to let LV know you wont need the large chunks of memory a subvi needed for temporary buffers. I don't know the inner workings on LV garbage collection but I found that the request deallocation has helped me out of a few difficult situations. As far as deallocating memory while a vi or subvi is still running (like is possible in c/c++) I haven't figured out how to do it if it is even possible.
Paul
09-15-2005 08:09 AM
A few additional questions on deallocation:
1.Is there overhead associated with the request deallocation?
2.If deallocation is essentially a Boolean state of a subvi/vi why isn't it set using the property node (or better yet through a setting under vi->properties), this would seem to fit better under LV's data-flow model.
3.Are there any times where setting request deallocation causes problems with LV, any known bugs? (platform independence)
I know this is a little used feature, I haven't had problems with it ever but am very reserved when using it.
Paul
09-16-2005 06:14 PM
10-03-2005 02:57 PM
Philip,
Thanks for the clarification about reusing data memory on subsequent calls of a vi. What happens if you need a different size memory space on each call, can this memory be reused, I assumed that only static sized memory variables can be reused, but I could be wrong. If you can not reuse memory space for certain cases then repeitive calls to such a vi would have to free memory as to avoid a memory leak. Is this still the case?
10-05-2005 12:40 AM