LAVA 1.0 Content Posted January 29, 2007 Report Share Posted January 29, 2007 Hi all, I'm building a Vision application that will run on different PCs with different amount of RAM from 512Mo to 4Go. Basically images will be acquired with a PCIe 1429 to the system memory, so in order to prevent the user from allocating more memory than disponible, I'd like to programatically get the amout of free ram memory (like we can see when opening window's task manager). Is that possible and how ? Thanks in advance for any help Quote Link to comment
David Boyd Posted January 29, 2007 Report Share Posted January 29, 2007 This BD snippet shows one way to get this info, though it assumes you're running under Windows and have access to .NET methods.Hope this helps.Dave EDIT: The constructor is from System.Diagnostics. Quote Link to comment
LAVA 1.0 Content Posted January 31, 2007 Author Report Share Posted January 31, 2007 Hi Dave and thanks for your help, I do have .NET access but I am not familiar with it... What constructor shall I select from the list in the "Select constructor" window ? It seems to me like I need to have a dll and use the browse function to point on it, am I right ? Which dll shall I look for ? Thanks in advance Quote Link to comment
David Boyd Posted January 31, 2007 Report Share Posted January 31, 2007 ... What constructor shall I select from the list in the "Select constructor" window ? You should not need to browse for DLLs... On the block diagram, drop a .NET constructor node (Connectivity->.NET->Constructor Node). From its configuration dialog, select the 'System' assembly from the dropdown. Find the 'System.Diagnostics' entry in the objects list, expand its tree and select 'PerformanceCounter'. From the list of constructors, I chose the constructor prototype which takes two parameters, categoryName and counterName. Wire string constants to these as I showed in the BD snippet. Then you'll need a create a .NET method node for NextValue() as shown. Dispose of the reference when through. If you're going to invoke this repeatedly, you should consider placing the constructor outside the loop, and maintain the reference wire for calling NextValue(). The .NET constructors seem to be pretty time-intensive to execute (in my experience). Hope this is clear. Dave Quote Link to comment
LAVA 1.0 Content Posted January 31, 2007 Author Report Share Posted January 31, 2007 Thanks a lot Dave that's very clear :thumbup: It's the first time I use .NET... Quote Link to comment
robijn Posted January 31, 2007 Report Share Posted January 31, 2007 And without dotnet, only up to 4GB: all 8 elements of the cluster are U32. Quote Link to comment
LAVA 1.0 Content Posted February 1, 2007 Author Report Share Posted February 1, 2007 And without dotnet, only up to 4GB: all 8 elements of the cluster are U32. Great idea robijn ! This is a lot faster than the .NET call thanks ! 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.