Jump to content

Question about Write Panel to INI__ogtk.vi


Recommended Posts

Good afternoon,

 

I have a question regarding the subVI called "Write Panel to INI__ogtk.vi" in Labview version 2012. It seems like the input parameter "VI ref" is a reference that is not closed by this VI (specifically where the property node used to obtain the VI name is located). I was wondering if this can cause a memory leak?

 

Thank you.

Link to comment

Yup, the only potential memory leak is if this function opened a new VI reference, but didn't close it, or return it to be closed.  The way the function works now, it will take a reference it assumes is already opened and then not close it.  Generally if you open a reference, it should be closed in the same place it is opened.  But honestly most of the time I use that function it is with a This VI reference which doesn't need to be closed anyway.

Link to comment

Does this imply that, in general, "This VI" references do not need to be closed? So I am guessing that memory leaks typically arise from other references (e.g., control refnums, indicators, files, etc.)?

 

Some refs are static; they always exist and you are neither creating or destroying them.  â€œThis VI†and control refs are of this type.   “Closing†these refs is a no-op.  Other refs are both dynamically created and involve holding resources open of some kind (like an open file, or a Queue or something).  Here is where one worries about ‘memory leaks’.  

Link to comment

"This" is a term I've heard NI use to refer to these types of references.  If a reference is a This reference (like the This VI, or This Application, or This Control) then yes closing it is a no-op.  The reference simply cannot be closed because it is being used.  One way to know if your reference is a This or not, is to cast it to a U32 and look at the refnum.  If the number changes with each run of your VI then it is a new reference and should be closed.  If it is the same then there isn't a need to close it.  I've also done a test where I run the VI using the run continuous and see if the memory in task manager increases.  If it doesn't then what ever references I'm opening and is enough for a stable system.

Link to comment

I talk about which references should be closed vs. which ones you don't have to worry about closing in my Brainless LabVIEW presentation.

I was emphatically with you right up until the "train tracks" (my OCD prevents your version and there are genuine reasons for pass-through for optimizations) and palettes.(time and motion studies on placing primitives is ridiculous - you can make mistakes faster? :P ).

 

Nice to see a fellow heathen picking holes in accepted dogma. Beginning to think I was the only one :D

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.