drjdpowell Posted February 19, 2021 Report Share Posted February 19, 2021 Is there any way to list all IMAQ images currently in memory? This is as a diagnostic and code check, rather than to actually use this in code. Quote Link to comment
drjdpowell Posted February 19, 2021 Author Report Share Posted February 19, 2021 (edited) As a side question, how do people deal with the non-standard way that IMAQ image references work (alway globally named; don't clean up when owning VI goes idle)? For background, I am currently trying to get a large amount of non-reentrant image analysis code to work reentrantly, and have to deal with preventing one clone of a VI modifying an image inadvertently shared with another. I am attacking the problem by auto-generating image names based on call site (ie, a pre-allocate clone that uses its own clone id in the image name): Edited February 19, 2021 by drjdpowell Quote Link to comment
dadreamer Posted February 19, 2021 Report Share Posted February 19, 2021 21 minutes ago, drjdpowell said: Is there any way to list all IMAQ images currently in memory? How to get a list of image buffers? 22 minutes ago, drjdpowell said: how do people deal with the non-standard way that IMAQ image references work When I need some piece of code to run in a few instances simultaneously, I just set unique image names based on the meaning/purpose, what that code is invoked for (e.g., "sensor 1 - binarization" or "scanner - edge locator" and sort of). No extra magic here. And I even don't dispose the rest of images, as they are always reused on subsequent runs of the program (and between loop iterations too). Although I never launched too many IMAQ code in parallel (max. 5 threads, I think). 1 Quote Link to comment
Francois Normandin Posted February 19, 2021 Report Share Posted February 19, 2021 1 hour ago, drjdpowell said: As a side question, how do people deal with the non-standard way that IMAQ image references work (alway globally named; don't clean up when owning VI goes idle)? Whenever it's been used in a project that I knew would persist more than for a simple demo, I've always wrapped the IMAQ API into an image class that handles the name generation with GUIDs to avoid collisions. Sometimes I'll add a singleton registry to keep track of references, but my IMAQ-flavored apps have generally been of low complexity, so I typically maintain a list of objects in the process' private data. When I need to leak the images across multiple processes, it is generally a delegation pattern, and the caller is still responsible for the reference's lifetime. Quote Link to comment
bmoyer Posted February 19, 2021 Report Share Posted February 19, 2021 That's pretty much what I do too. When I have a re-entrant VI that creates IMAQ refs, I use the VI clone name as part of the Image Name. If you're concerned about the memory used when the VI isn't active, you can close the IMAQ refs and then later reopen them, but I don't usually bother doing this much anymore, as most (if not all) of my Imaging apps are developed in 64-bit now. Quote Link to comment
drjdpowell Posted February 19, 2021 Author Report Share Posted February 19, 2021 3 hours ago, dadreamer said: 3 hours ago, drjdpowell said: Is there any way to list all IMAQ images currently in memory? How to get a list of image buffers? Thanks! That's great. Quote Link to comment
drjdpowell Posted February 19, 2021 Author Report Share Posted February 19, 2021 2 hours ago, Francois Normandin said: Whenever it's been used in a project that I knew would persist more than for a simple demo, I've always wrapped the IMAQ API into an image class that handles the name generation with GUIDs to avoid collisions. Sometimes I'll add a singleton registry to keep track of references, but my IMAQ-flavored apps have generally been of low complexity, so I typically maintain a list of objects in the process' private data. When I need to leak the images across multiple processes, it is generally a delegation pattern, and the caller is still responsible for the reference's lifetime. I would much rather than IMAQ references behaved the same as other LabVIEW references, like Queues. 1 Quote Link to comment
Popular Post drjdpowell Posted February 25, 2021 Author Popular Post Report Share Posted February 25, 2021 Update: I used the dll call from the link @dadreamer provided, and made a Messenger-Library "actor" that I can use for debugging. Already found a couple of bugs with it. 3 Quote Link to comment
drjdpowell Posted February 26, 2021 Author Report Share Posted February 26, 2021 Code for this posted at NI: https://forums.ni.com/t5/JDP-Science-Tools/IMAQ-Images-Monitor/m-p/4131248#M31 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.