heap allocation and gc with gcj

Vladimir Leven vladimirl@wrx-ca.com
Tue May 4 22:18:00 GMT 2004


Using GCJ (3.2.2) If I do the following in a loop:

while (true) {
    byte[] bytes = new byte[1024];
    //do some unrelated stuff
    bytes = null;
}

Will the array be allocated each time the loop runs or will the compiler 
remove it because it is not used in the method? What about if it is a 
public instance variable?

Thanks,

Vlad




More information about the Java mailing list