LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

when a subvi call its occupy memory ,after exceution how to realese that memory

When a top-level VI calls a subVI, LabVIEW allocates a data space of memory in which that subVI runs. When the subVI finishes running, LabVIEW does not deallocate the data space until the top-level VI finishes running or until the entire application stops, which can result in out-of-memory conditions and degradation of performance. so how to realease that memory

0 Kudos
Message 1 of 5
(2,802 Views)

If LabVIEW needs memory in order to execute code, it will allocate that memory. If the memory is available, LV will keep this memory until the code is unloaded. There is no other way to free memory by force.

So the memory will only be freed if you close the toplevel VI, not when it finishes execution. But if the subVI is not executed anymore, LV will probably use the allocated memory for other VIs; nevertheless,LV will keep the memory in the first place.

 

So your question is only valid, if you have other processes than LV running in parallel and your whole system is running short in memory. But then, the issue is not only LV related....

 

hope this helps,

Norbert 

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 5
(2,788 Views)

You can use the Request Deallocation VI found in the memory control palette of the application control palette. place the VI in the sub VI and it will clear the memory after it is closed.

 

What are your reasons for wanting to use it? LabVIEW is a managed arcitecture, and it does not usually need to be used

_____________________________
- Cheers, Ed
0 Kudos
Message 3 of 5
(2,787 Views)

yenknip wrote:

You can use the Request Deallocation VI found in the memory control palette of the application control palette. place the VI in the sub VI and it will clear the memory after it is closed.

[...]

That is not true. The memory manager in LV keeps the memory since he does not know if in the near future, new memory will be needed. Therefore, LV will keep the memory except that other applications require memory. In only that case, the "Request Deallocation" could free some memory.

 

That function is one of the most misunderstood functions in LV. It does not compare in any way to "free" known from e.g. ANSI C.

As the name already states, it is only a request. Nothing more.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 5
(2,775 Views)

Thanks Norbert, I understand that it only frees the memory back to the memory manager, much the same way as .NET frees memory back to the manager, and that the memory manager decides whether to release memory back to the OS.

 

I have to admit that the word "request" never clicked in my head 😛

_____________________________
- Cheers, Ed
0 Kudos
Message 5 of 5
(2,770 Views)