Hi,
This might be pretty basic, but was very curious to know. Here's the code snippet and the output
public class PlainSystemGC {
public static void main(String ...strings) {
System.out.println("Free Memory (Before GC): " + Runtime.getRuntime().freeMemory());
System.gc();
System.out.println("Free Memory (After GC): " + Runtime.getRuntime().freeMemory());
}
}
and the output
Free Memory (Before GC): 1859640
Free Memory (After GC): 1911768
I am interested to know what is GC collecting here since no objects are created.
What's the memory thats being freed up ? ( and that too 52kb )
@JSauer - It gives Exactly the same results even if run 100 times