LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a tool that reads the number of assigned RefNums (primarily Queues)?

Hi-
 
I have been troubleshooting a memory leak caused by queues, and have found the following link helpful:
 
My question is: Is there a tool that I can use that will show me how many refnums are opened in memory? Preferably with the references name? It would make verifying queue memory leaks and their eradication so much easier! If such a tool does not exist, could it be added to the VI profiler sometime in the future?
 
Thanks!
 
-Randy
0 Kudos
Message 1 of 3
(2,632 Views)
BUMP. I am curious too.  But I suspect not.
A couple of things:
  1. Looking queues up by name creates a new reference to that queue (even if it exists).  So if you have a VI that runs for a long time repeatably looking it up by name, it will bleed the memory dry.
  2. Setting the "force destroy" of the release queue to true will destroy all references to that queue.  Freeing up that memory.
  3. As you are aware, I uses queues in my primary architecture.  I have run them in 30 plus day trials with no problems.  (I realize this is not helping you.) so by NI side implementation, there is no problem.
  4. I am not sure how much of a bear it would be, but you could wrap the "create queue" and log the number of creates that you are running. You can wrap the release queue, and see which are getting released.  Keep in mind if you "create" the same queue twice you will have two references open to that queue.  Force destroy closes both, otherwise, you are left with the remaining.  It is a management nightmare.  The latest incarnation of my statecase manager implements queue tracking. The nice part of this, is that I can actually pass events to any queue running, and save myself the trouble of looking it up by name.
But you do have your work cut out for you, depending on the size of your program. 
Good luck.

Paul
0 Kudos
Message 2 of 3
(2,601 Views)

Hi Paul-

Yeah, I discovered that opening a queue by name creates a new reference, even if it is open elsewhere, the hard way - my system crashed after five hours. I, too, have been using queues in state machines, as you know, and have not run into this problem before, but also have not controlled the state machine from outside its VI. Live and learn. I've fixed the problems, and it has been running over two days with no problem.

My main concern was to express to NI that a method of viewing the number of refnums, if not the refnums themselves, would have been invaluable in tracking down this issue, and to validate that all were captured. I do not know if posting to the general forum is a good way to raise concerns, but I could not put this in the "new features" section of the forum, so it is here.

By the way, it is interesting that VISA does not handle its refnums as queues: Opening VISA references, even in different VIs seem to use the same refnums.

Thanks for the reply, and hope to see you sometime in the near future!

-Randy

0 Kudos
Message 3 of 3
(2,577 Views)