How to find the total and free memory available in RAM. and used & free space available in each disk

Discussion in 'Java' started by kathirvel.com@gmail.com, Nov 2, 2006.

  1. Guest

    Hi,
    How to find the total memory space and free space available
    in RAM. and how to find the used and free space available in a Disk?
    If there is any code please do provide me...

    regards,
    thanks,
    kathir
    , Nov 2, 2006
    #1
    1. Advertising

  2. Am 2 Nov 2006 02:06:22 -0800 schrieb :

    > Hi,
    > How to find the total memory space and free space available
    > in RAM. and how to find the used and free space available in a Disk?
    > If there is any code please do provide me...


    As for RAM, in old Java 1.3 code I did it this way:

    Runtime rt = Runtime.getRuntime();
    long free = rt.freeMemory();
    long total = rt.totalMemory();
    long used = rt.totalMemory() - rt.freeMemory();
    double utilization = (double) used / (double) total;

    I believe in 1.5 there may be other ways.

    -- Sebastian
    Sebastian Millies, Nov 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jas Shultz
    Replies:
    0
    Views:
    936
    Jas Shultz
    Dec 3, 2003
  2. minil
    Replies:
    11
    Views:
    1,691
    Walter Roberson
    Mar 14, 2005
  3. Replies:
    6
    Views:
    1,732
    CBFalconer
    Jun 18, 2007
  4. Daniel
    Replies:
    2
    Views:
    1,410
    Tim Golden
    Aug 31, 2009
  5. Ron Heiby
    Replies:
    13
    Views:
    190
    Joe Smith
    Jun 29, 2004
Loading...

Share This Page