package ru.szhernovoy;


/**
 * Created by szhernovoy on 03.10.2016.
 */
public class User {
   private String name;
   private Integer age;


    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }


    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println(String.format("User %s is finalize",this));

    }

    @Override
    public String toString() {
        return "name='" + name + '\'' +
                ", age=" + age;
    }

    public void info(){
        int mb = 1024 * 1024;
        Runtime runtime = Runtime.getRuntime();
        System.out.println("##### Heap utilization statistics [MB] #####");
        System.out.println("Used memory: "+ (runtime.totalMemory() - runtime.freeMemory())/mb + "Mb");
        System.out.println("Free memory: "+ (runtime.freeMemory())/mb + "Mb");
        System.out.println("Total memory: "+ (runtime.totalMemory() )/mb + "Mb");
        System.out.println("Max memory: "+ (runtime.maxMemory() )/mb + "Mb");
    }

    public static void main(String[] args) {
        for (int index = 0; index < 10000; index++){
            System.out.println(new User(String.valueOf(index),index));
        }
    }

}

@@ -134,16 +134,37 @@
 er age;%0A
+    private int pol;%0A
 %0A%0A    pu
@@ -193,16 +193,25 @@
  int age
+, int pol
 ) %7B%0A    
@@ -252,24 +252,48 @@
 .age = age;%0A
+        this.pol = pol;%0A
     %7D%0A%0A%0A    
@@ -1272,16 +1272,22 @@
 x),index
+,index
 ));%0A    

update garbage collection lesson1