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. Advertisements

  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. Advertisements

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:
    1,224
    Jas Shultz
    Dec 3, 2003
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    3,230
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    2,269
    Stephen Horne
    Oct 27, 2003
  4. minil
    Replies:
    11
    Views:
    2,040
    Walter Roberson
    Mar 14, 2005
  5. Replies:
    6
    Views:
    1,984
    CBFalconer
    Jun 18, 2007
  6. Daniel
    Replies:
    2
    Views:
    1,631
    Tim Golden
    Aug 31, 2009
  7. Ron Heiby
    Replies:
    13
    Views:
    340
    Joe Smith
    Jun 29, 2004
  8. Replies:
    8
    Views:
    256
    Rasto Levrinc
    Feb 4, 2005
Loading...