This question already has an answer here:
I have a Java function that returns this :
Free memory: 56 651
Allocated memory: 298 496
Max memory: 901 120
Total free memory: 659 275
here is the function :
public String MemInfo() {
NumberFormat format = NumberFormat.getInstance();
StringBuilder sb = new StringBuilder();
long maxMemory = runtime.maxMemory();
long allocatedMemory = runtime.totalMemory();
long freeMemory = runtime.freeMemory();
sb.append("Free memory: ");
sb.append(format.format(freeMemory / 1024));
sb.append("<br/>");
sb.append("Allocated memory: ");
sb.append(format.format(allocatedMemory / 1024));
sb.append("<br/>");
sb.append("Max memory: ");
sb.append(format.format(maxMemory / 1024));
sb.append("<br/>");
sb.append("Total free memory: ");
sb.append(format.format((freeMemory + (maxMemory - allocatedMemory)) / 1024));
sb.append("<br/>");
return sb.toString();
}
I want to know the meaning of each information and the relation between "free memory" "allocated memory" "max memory" and "total free memory"
PS : i want to do some charts with those numbers !
Aucun commentaire:
Enregistrer un commentaire