How to retrieve total amount of system RAM?

Steven Schveighoffer schveiguy at yahoo.com
Wed Aug 13 12:17:53 PDT 2008


"Denis Koroskin" wrote
> On Wed, 13 Aug 2008 22:39:36 +0400, Steven Schveighoffer
>> "Benji Smith" wrote
>>> I've been looking through Tango documentation for a function that'll 
>>> tell
>>> me the total amount of RAM installed on the system, bu I can't find
>>> anything that looks helpful. Anyone have any suggestions?
>>>
>>> Thanks!
>>
>> This is something that is highly OS-dependant (and even different 
>> versions
>> of the same OS do it differently).  It's not something that Tango is 
>> likely
>> to provide an abstract interface for.
>>
>> -Steve
>>
>>
>
> The same goes for IO (console I/O, file I/O, socket etc). Despite that it 
> is present in Tango.
>
> I see a huge benefit of having (at least basic) OS statistics (like OS 
> name, version, type, device presence and capabilities - RAM, CPU, etc) in 
> the standard library. Isn't is supposed to eliminate custom 
> platform-specific code?

Getting system memory isn't part of any standard that I know of (at least on 
the posix side), and there's not a large demand for it.  The API for getting 
memory is decided on by OS implementors.  What you would end up with is a 
list of versions for not only different OSes, but different versions of the 
OS.  It's along the same lines as getting/setting network interface 
addresses.



More information about the Digitalmars-d-learn mailing list