In java, when does object space die out, which is created by "new" operator -


i write java program, , wanna clear memory management in java. example, method this:

 public void example1() {         byte[] bytes = new byte[100];     } 

after calling method, byte[] space created "new" in heap space die out? 2th example this:

public byte[] example2() {        byte[] bytes = new byte[100];        return bytes } 

also question, byte[] space die out in situation?

the space garbage collected when garbage collector runs , detects there no more references it. in case if code concerned reference ceases exist when method exits, space eligible collection onwards.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -