...
| Code Block | ||
|---|---|---|
| ||
public class Leak {
static Vector vector = new Vector();
public void leakingVector(int count) {
for (int n = 0; n n<count< count; n++) {
vector.add(Integer.toString(n));
}
for (int n = count - 1; n>0n > 0; n--) { //free the memory
vector.removeElementAt(n);
}
}
public static void main(String[] args) throws IOException {
Leak le = new Leak();
int i = 1;
while(true) {
System.out.println("Iteration: " + i);
le.leakingVector(1);
i++;
}
}
}
|
...
| Code Block | ||
|---|---|---|
| ||
for (int n = count - 1; n n>>= 0; n--) { vector.removeElementAt(n); } |
...