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: 

Do i have to close reference after open?

Hello,

i have one vi that Opens & Starts 10times in a loop the same vi (see picture).

This vi is running very fast and is restarted each second by the calling vi.

Currently there is no "Close reference" at the end of all. Is this needed?

If yes: What is the consequence when running the vi without it?

 

My current problem is that the CPU usage rises although the program is always doing the same.

Can this be the result of a missing "Close Reference"?

Thx

 

 

 

OpenVi.jpg

0 Kudos
Message 1 of 8
(2,763 Views)

@OnlyOne wrote:

Hello,

i have one vi that Opens & Starts 10times in a loop the same vi (see picture).

This vi is running very fast and is restarted each second by the calling vi.

Currently there is no "Close reference" at the end of all. Is this needed?

If yes: What is the consequence when running the vi without it?

 

My current problem is that the CPU usage rises although the program is always doing the same.

Can this be the result of a missing "Close Reference"?

Thx

 

 

 

OpenVi.jpg


memory leak if you intend on running the program for several days

ask Bloxx about it

 

Message 2 of 8
(2,759 Views)

why are you calling your vi in a  loop every time.

Can't you put the while loop inside the called VI.

i do not see wait anywhere in loop so CPU usage will be high.

and yes you need to close references you opened.

Message 3 of 8
(2,743 Views)

@Neos wrote:

why are you calling your vi in a  loop every time.

Can't you put the while loop inside the called VI.

i do not see wait anywhere in loop so CPU usage will be high.

and yes you need to close references you opened.


He is calling different clone instances of his VI.  That is why it is in a loop (a new instance each iteration).  I'm just not sure why they just didn't use a FOR loop.  The second loop will wait for each instance to complete, so no need to worry about CPU usage.

 

And yes, you should really close your references.

Closing References in LabVIEW


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
Message 4 of 8
(2,724 Views)

@crossrulz wrote:

@Neos wrote:

why are you calling your vi in a  loop every time.

Can't you put the while loop inside the called VI.

i do not see wait anywhere in loop so CPU usage will be high.

and yes you need to close references you opened.


He is calling different clone instances of his VI.  That is why it is in a loop (a new instance each iteration).  I'm just not sure why they just didn't use a FOR loop.  The second loop will wait for each instance to complete, so no need to worry about CPU usage.

 


Ooooo, Its good for me that i posted a reply to this thread.

 

Can i give you more than one kudos for same postSmiley Happy.
Message 5 of 8
(2,717 Views)

What happens if CloseReference is not used?

Does it mean the opened VI stays in memory? So each time i open a new reference of the vis the used memory rises of the vi-file-size?

Thx

0 Kudos
Message 6 of 8
(2,682 Views)

If you read to that link what crossrulz has given

 if LabVIEW leaks a control reference, LabVIEW stores refnums and related control data in memory. However, if LabVIEW leaks a VI reference, LabVIEW stores a whole VI in memory.

0 Kudos
Message 7 of 8
(2,678 Views)

Oops, i didnt see that link. Looks like part of the signature.

Thx

0 Kudos
Message 8 of 8
(2,673 Views)