LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Preallocated clones vs shared clones

Hi,

 

Im building an application that plays and records sound via multiple (20) soundcards. The playback and recording parts are incapsulated within a VI called Process.VI. The Process.VI contains several layers of different subVIs.

 

The Process.VI is running in prallel (one for each sound card) and is there for a reentrant clone along with all its subVIs. I have chosen to set the Process.VI and all its subVIs to be preallocated reentrent clones instead of shared clones and this is to minimize jitter and call overhead. I know that this means that LabVIEW must allocate a clone for each instance of all VIs but will this become a problem for me given the fact that the loops that contains all VIs are running pretty fast. The playback loop and the recording loop are running with 40 ms timing due to the requirement of small buffer sizes.

 

Will the memory usage grow due to that all VIs are preallocated clones and repeatdly called every 40 ms?

 

 

LabVIEW version: 12.0.1f5

 

 

Best regards

Jon

JonS
0 Kudos
Message 1 of 6
(5,383 Views)

Probotector wrote:

Will the memory usage grow due to that all VIs are preallocated clones and repeatdly called every 40 ms?


Are you dynamically calling the VIs?  That's the only time this would cause an issue.  Otherwise all of the VI calls are already set in memory.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(5,360 Views)

Hi crossrulz,

 

Thanks for your input on this matter!

 

The "top VI" Process.vi is dynamically called by the GUI VI to get rid of any UI thread dependencies and it is along with all its subVIs preallocated clone reentrants. Could that be the reason for the memory leakage? Should i change the Process.VI to be shared clone reentrant but leave its subVIs (those that are within the recording and playback loops) to be preallocated?

 

Cheers,
Jon

JonS
0 Kudos
Message 3 of 6
(5,346 Views)

Are you closing the reference to the dynamically called VI when it is done running?  That would be a source of a memory leak.  The VI (and all of its called clones) should be removed from memory on closing of the reference.  I just feel that changing to shared clone is just covering up the issue and could cause other issues if you have state information.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(5,301 Views)

crossrulz,

 

The problem with memory leakage is not caused by too many dynamic calls to the Process.VI. The call is made only once per sound card (20 times in total). The Process.vi clones are then running during the whole test period and a test can be up to 4-5 days.

 

In other words, the memory leakage takes place while the 20 clones are running and Im wondering if that has something to do with the fact that most of the VIs are preallocated clones.

JonS
0 Kudos
Message 5 of 6
(5,291 Views)

If they are all running, then shared vs preallocated won't matter.

 

I would reevaluate your subVIs.  Those that are really quick my be able to be non-reentrant.  That could save you a lot of memory at the expense of possible jitter (no more than Windows will do to you though).  The compromise between the preallocated reentrant and the non-reentrant is the shared clone reentrant.  But if you have state in any of those subVIs, the should never be set to shared clone.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(5,284 Views)