LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

All VIs in Memory (Including Clones)

I'm looking to get a list of all the VIs in memory.  The following works fine.all VIs in Memory.png

 

 

2024-12-11 - 16-16-59.777 - Screen Number 3.png

 

However, I would also like to see the clone instances that I start using the "run" method.  The call 

all VIS.png

 

doesn't seem to do this.  Is there another method that will get everything running (including the clones)?  I'm assuming I'm either missing something, or LV simply won't let me do this.  Does LV consider them other application instances or something?

0 Kudos
Message 1 of 21
(496 Views)

Hi joshua,

 

The VI clone names are not officially accessible from the application instance, but you can sort of work this around by generating clone names yourself using this VI: "<LabVIEW>\vi.lib\VIServer\Generate Clone Name.vi".

 

For each VI listed by App.AllVIs, you could check whether it is reentrant (VI property Execution > Is Reentrant), then generate e.g. the first 100 clone names and try to open them by reference. The only downside is that you don't known how many there will be, so you have to choose a fixed limit. Also, fixing the limit too high will take a lot more time because "Open VI Reference" is not fast at checking whether the VI exists in memory or not.

 

P.S.: Not sure that will change anything, but you can still kudo this idea:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Have-All-Clones-included-in-AllVIsInMemory-property/i...

 

Regards,

Raphaël.

0 Kudos
Message 2 of 21
(474 Views)

Can you explain why you are trying to do this?

 

It may be that there's an alternate way to do what you want, but by focusing only on the "App.AllVIs" property and not your general task, we can't suggest anything else.

0 Kudos
Message 3 of 21
(452 Views)

@raphschru wrote:

Hi joshua,

 

The VI clone names are not officially accessible from the application instance, but you can sort of work this around by generating clone names yourself using this VI: "<LabVIEW>\vi.lib\VIServer\Generate Clone Name.vi".

 

For each VI listed by App.AllVIs, you could check whether it is reentrant (VI property Execution > Is Reentrant), then generate e.g. the first 100 clone names and try to open them by reference. The only downside is that you don't known how many there will be, so you have to choose a fixed limit. Also, fixing the limit too high will take a lot more time because "Open VI Reference" is not fast at checking whether the VI exists in memory or not.

 

P.S.: Not sure that will change anything, but you can still kudo this idea:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Have-All-Clones-included-in-AllVIsInMemory-property/i...

 

Regards,

Raphaël.


You can get the number of clones:

paul_a_cardinale_0-1733962453218.png

Message 4 of 21
(450 Views)
Message 5 of 21
(439 Views)

@paul_a_cardinale wrote:

 

You can get the number of clones:

paul_a_cardinale_0-1733962453218.png


For me it only works when the VI is not currently running, otherwise it gives error 1000: The VI is not in a state compatible with this operation.

So I guess it can't be used for making a task manager.

0 Kudos
Message 6 of 21
(400 Views)

@Kyle97330 wrote:

Can you explain why you are trying to do this?

 

It may be that there's an alternate way to do what you want, but by focusing only on the "App.AllVIs" property and not your general task, we can't suggest anything else.


Partially to see if it can be done.  Partially, to get better visibility on what's going on.  My application is making LOTs of clones.  I could see a situation where I'm making many more than I need to.. let's call it a clone leak.. and having an additional troubleshooting tool would be nice.

0 Kudos
Message 7 of 21
(387 Views)

@paul_a_cardinale wrote:

Try this.


 

This looks much closer to what I want.  I can pull the list of VIs, grab their reference feed them into this VI and get the clone names.  I know each VI can't have more clones than the total number of clones in the system.  With that said, I probably won't use it.  When I read the context help for Generate Clone Name.vi it basically says it'll cause system instability.

 

help.png

 

I think the "Get Number of Clones" will get me 90% of where I want to be w/o the risk.  In my mind, from the responses, I think the answer is it's possible.... but may not be a good idea.  I do agree that this would be a handy feature to have in LV (without all the caution statements).

 

For anyone else going down this rabit hole, I modified my code:

 

2024-12-12 - 08-59-06.691 - Screen Number 3.png

v2.png

 

However, when I sort by "Number of Clones" the "winner" is only six clones.  I know for a fact, that I have 50+ clones for a particular VI running in the background.  So that VI must not be in memory to get polled.  So, I suppose, I could search the project for all my packed libraries (all the clones originate from packed libraries), make a list of all the VIs in them, and then create additional references to each VI and get the info..  But this seems like a pretty bad idea for me.  The code already takes forever to execute.

0 Kudos
Message 8 of 21
(385 Views)

@joshua.l.guthrie2.civ wrote:

I'm looking to get a list of all the VIs in memory. 


Yes, so does everyone.

 

Officially, references to clones are not supported at all.

 

I don't know any except to brute forcing the VI names...

 

There used to be a more efficient way to calculate those clone names. Most of that calculation used to be the same for each clone, so recalculating it used to take a lot more time. IIRC, calculating one and simply adding 1 to the result used to work. Maybe it still does.

 

Metrics.NumberOfClones doesn't work well... It only returns the number of clones if none of the clones are running, or just the original, or who knows. Sometimes it works often it doesn't. I can imagine it's related to the time the metrics are calculated, but who knows.

0 Kudos
Message 9 of 21
(349 Views)

wiebe@CARYA wrote:

I don't know any except to brute forcing the VI names...


Maybe there is a way using the CookieJar, but I know very little about that.

0 Kudos
Message 10 of 21
(346 Views)