Name: elR10090 Date: 11/28/2003
I'm filing this bug to emphasize the issue revealed
by the test:
nsk/stress/memory/memleak006
and reported with the bug:
4956026 Increase the timeout.
While evaluating the test bug 4956026, I've found that
Tiger-b29, 64-bits Server VM, spends many time in vain
for needless attempts of collecting garbage.
I've rewritten the test to make it a bit clearer what
is the fault scenario. Please see the updated variant
as the test mm6.java below. The specificy of the test
mm6 is that it explicitly allocates x[j] elements for
the huge 2-dimensional array x[][].
If the int[][] array x is succesfully allocated with
a new int[len][] array of int[] references; the test
mm6 starts the cycle to allocate x[j] for each j with
a new int[len] array. As the value of len*len is too
much anyway (millions of gigabytes), this cycle must
result in OutOfMemoryError for some j'th iteration.
The point is, the Tiger's VM spends much more time to
detect the lack of memory that Mantis spends. Here are
the logs of my runs against Tiger-b29 and Mantis-b25.
I've used 8-CPU (SPARC/v9) machine with 8Gb of RAM:
% time /home/latkin/jdk1.5/bin/java -d64 -Xmx4g -verbose:gc mm6
i = 0, j=-1, len = 1000000000
i = 1, j=-1, len = 500000000
[GC 1953309K->1953269K(2799808K), 388.3033920 secs]
[GC 1953269K->1953285K(2802880K), 438.2987816 secs]
[Full GC 1953285K->1953233K(2205504K), 41.0378874 secs]
[GC 1953233K->1953233K(2802880K), 441.4371139 secs]
[Full GC 1953233K->1953232K(2205632K), 37.1156034 secs]
i = 2, j=0, len = 250000000
[GC 1953355K->1953232K(2808640K), 447.7919364 secs]
[GC 1953232K->1953232K(2808704K), 425.2679931 secs]
[Full GC 1953232K->1953232K(2211520K), 41.9634991 secs]
[GC 1953232K->1953232K(2819968K), 429.7352058 secs]
[Full GC 1953232K->1953232K(2222848K), 33.4922985 secs]
i = 3, j=-1, len = 125000000
[GC 2686119K->2685654K(2819968K), 488.1438908 secs]
[Full GC 2685654K->2685654K(2819968K), 47.8311575 secs]
[GC 2685654K->2685654K(2841216K), 397.0494616 secs]
[Full GC 2685654K->2685654K(2841216K), 45.3557303 secs]
i = 4, j=1, len = 62500000
12923.0u 22.0s 1:02:28 345% 0+0k 0+0io 0pf+0w
% time /home/latkin/jdk1.4.2/bin/java -d64 -Xmx4g -verbose:gc mm6
i = 0, j=-1, len = 1000000000
i = 1, j=-1, len = 500000000
[GC 155K->108K(3520K), 0.0165322 secs]
[Full GC 108K->108K(3520K), 0.0280476 secs]
[GC 1953233K->1953233K(1956648K), 0.0790172 secs]
[Full GC 1953233K->1953233K(1956648K), 63.9245000 secs]
[Full GC 2929796K->2929796K(4153216K), 34.4460004 secs]
[Full GC 2929796K->2929795K(4153216K), 41.1711967 secs]
i = 2, j=1, len = 250000000
[Full GC 2929811K->2929795K(4153216K), 40.5874700 secs]
[Full GC 2929795K->2929795K(4153216K), 56.6698979 secs]
i = 3, j=-1, len = 125000000
[Full GC 3906374K->3906358K(4153216K), 48.6680474 secs]
[Full GC 3906358K->3906358K(4153216K), 44.0415935 secs]
i = 4, j=2, len = 62500000
247.0u 33.0s 7:35 61% 0+0k 0+0io 0pf+0w
Here I must confess, that my experiment was not completely pure;
about 20-40% of machine resources were occupied with other users
applications. Anyway such dramatical difference like 5-10 times
looks caused by a problem with Tiger performance.
Following is the source code for the test mm6.java:
import java.io.*;
public class mm6 {
public static void main(String args[]) {
System.exit(run(args, System.out) + 95);
}
public static int run(String args[], PrintStream out) {
int lim1 = 5;
int len = 1000000000;
int i = -1;
int [][][] a = new int [lim1][][];
for (i = 0; i < lim1; i++) {
int j = -1;
try {
a[i] = new int [len][];
for (j=0; j<len; j++)
a[i][j] = new int [len];
out.println("# FAIL: this is impossible!");
return 2;
} catch (OutOfMemoryError e) {
out.println("i = "+i+", j="+j+", len = "+len);
if (len > 20)
len /= 2;
else
break;
}
};
a = null;
return 0;
}
}
======================================================================
###@###.### 10/9/04 00:20 GMT