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 -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -