How to get total and free memory in java?

You can get the total memory size and free available memory using the totalMemory() and freeMemory() function at runtime as follows :

System.out.println("Total Available Memory : "+Runtime.getRuntime().totalMemory());
System.out.println("FreeAvailable Memory : "+Runtime.getRuntime().freeMemory());
Share on Google Plus

About Pranav

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment