473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Get total virtual memory

Hi,

Is there a way to obtain programmatically the total amount of
Virtual memory employed by a machine in .NET?

10x

CHris
Nov 16 '05 #1
5 7762
You have to call GlobalMemoryStatus function in Kernel32.dll using
dllimport.

--
Shak
(Houston)
"Christopher Attard" <ch*********@gfi.com> wrote in message
news:e6**************@TK2MSFTNGP11.phx.gbl...
Hi,

Is there a way to obtain programmatically the total amount of
Virtual memory employed by a machine in .NET?

10x

CHris

Nov 16 '05 #2
Hi Christopher,

"Christopher Attard" <ch*********@gfi.com> wrote in message
news:e6**************@TK2MSFTNGP11.phx.gbl...
Hi,

Is there a way to obtain programmatically the total amount of
Virtual memory employed by a machine in .NET?

10x

CHris


...
System.Management.ManagementObject logicalMem =
new System.Management.ManagementObject

("Win32_LogicalMemoryConfiguration.Name=\"LogicalM emoryConfiguration\"");

Console.WriteLine(
"Total virtual memory: {0}",
logicalMem["TotalVirtualMemory"].ToString());
...

Class System.Management.ManagementObject is in assembly
System.Management.dll.

Regards,
Daniel
Nov 16 '05 #3
Hi Christopher,

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
You have to call GlobalMemoryStatus function in Kernel32.dll using
dllimport.
"Christopher Attard" <ch*********@gfi.com> wrote in message
news:e6**************@TK2MSFTNGP11.phx.gbl...
Is there a way to obtain programmatically the total amount of
Virtual memory employed by a machine in .NET?


A P/Invoke (DllImport) signature for the GlobalMemoryStatus can probably be
found here: http://www.pinvoke.net/

--
Lars Wilhelmsen
http://www.sral.org/
Software Engineer
Teleplan A/S, Norway
Nov 16 '05 #4
Is it possible to use WMI ?
"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
You have to call GlobalMemoryStatus function in Kernel32.dll using
dllimport.

--
Shak
(Houston)
"Christopher Attard" <ch*********@gfi.com> wrote in message
news:e6**************@TK2MSFTNGP11.phx.gbl...
Hi,

Is there a way to obtain programmatically the total amount of
Virtual memory employed by a machine in .NET?

10x

CHris


Nov 16 '05 #5
OK thanks a lot

Chris

"Daniel Pratt" <ko******************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Christopher,

"Christopher Attard" <ch*********@gfi.com> wrote in message
news:e6**************@TK2MSFTNGP11.phx.gbl...
Hi,

Is there a way to obtain programmatically the total amount of
Virtual memory employed by a machine in .NET?

10x

CHris


...
System.Management.ManagementObject logicalMem =
new System.Management.ManagementObject

("Win32_LogicalMemoryConfiguration.Name=\"LogicalM emoryConfiguration\"");

Console.WriteLine(
"Total virtual memory: {0}",
logicalMem["TotalVirtualMemory"].ToString());
...

Class System.Management.ManagementObject is in assembly
System.Management.dll.

Regards,
Daniel

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michał Januszczyk | last post by:
Is there any _managed_ way of getting total physical memory installed in the machine Thanks in advanc Michał Januszczyk
3
by: Ronald | last post by:
Hi! As I ran in to errors like "Ran out of memory" and "Out of memory" I supposed my website might have memoryleaks. To trace a potential memory leak I isolated the IIS process and monitored the...
15
by: Heiner | last post by:
#include <stdio.h> class A { public: virtual A & operator= (const A &); virtual void test(const A &); }; class B : public A
5
by: Ian | last post by:
I have and Access 97 DB that prints a report that has many pages, sometime about 800-1000 page, each page contains a colour picture along with text boxes. The pictures are displayed on the...
3
by: Gregor Wind | last post by:
Hello all, for my image processing application I need a large amount of virtual memory. I read, that it is normaly possible to get 2GB of virtual memory for each process and when you modify the...
20
by: Daniel | last post by:
I have the following three classes class A { public: virtual void f() = 0; }; class B: public A {
3
by: sadanjan | last post by:
Hi , Appreciate if someone can clarify if database Share Memory Limit (2 GB ) in Unix 32 bit boxes is the top limit for all the databases put together in a database or is it for each of the...
7
by: dragoncoder | last post by:
Hello experts, I was just playing around wrote this code. sundev1:/home/ptiwary/rnd $ cat a1.cpp #include <iostream> using namespace std; class Base
6
by: zissop | last post by:
Hello I have a strange situation with my ASP.Net applications running on Windows 2003 Server x64. As soon as they get instantiated (a visitor hits a page). the virtual memory they allocate goes to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.