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
Post a Comment