[Mono-dev] Obtain the available memory

Paolo Molaro lupus at ximian.com
Thu Aug 25 09:48:24 EDT 2005

On 08/25/05 Joannes Vermorel wrote:
> I have seen that the PerformanceCounter class is yet unimplemented in mono,
> yet, I would like to emulate with mono, the following 
> <code>
> PerformanceCounter counter =
> 	new PerformanceCounter("Memory", "Available Bytes");
> </code>
> There is the possibility to resort to command-line and to parse the output
> of the "top -b" command, but I feel that this option is very poor because
> the "top" output is not standardised at all (also this solution may yield
> very poor performance).

While PerformanceCounter is not implemented, on Linux you can read the
/proc/meminfo file:
~$ cat /proc/meminfo 
MemTotal:      1035740 kB

As for PerformanceCounter: as I suggested in the past, someone running
windows should collect the names, types, and meanings of the counters
that we should make available and write them all in one place.
When we'll have that doc, we'll implement the support in mono.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list