|
Garbage Collection
Part:
1
2
3
4
5
6
7
8
9
(Continued from previous part...)
Comparing with the same test with JDK 1.4.0, JDK 1.3.1 increased the total
memory in smaller amounts. Other than this the output seems to be identical.
Outputs tail_16_08 and tail_16_16 were also very similar to JDK 1.4.0.
However, tail_16_24 had a surprise for me. The program ran to the end without
any memory problem:
Time Total Free Free Total Act. Dead Over
sec. Mem. Mem. Per. Obj. Obj. Obj. Head
0 1984 1815 91% 0 0 0 169
1 1984 1682 84% 128 128 0 174
1 1984 1552 78% 256 256 0 176
....
31 5484 220 4% 5120 2304 2816 144
32 5484 218 3% 5120 2176 2944 146
32 5484 216 3% 5120 2048 3072 148
33 8128 2780 34% 2176 2176 0 3172
33 8128 2780 34% 2304 2176 128 3044
34 8128 2651 32% 2304 2304 0 3173
34 8128 2521 31% 2432 2432 0 3175
....
41 8128 856 10% 4096 4096 0 3176
42 8128 731 8% 4224 4224 0 3173
42 8128 601 7% 4352 4352 0 3175
43 8128 472 5% 4480 4480 0 3176
43 8128 3421 42% 4608 4608 0 99
44 8128 3291 40% 4736 4736 0 101
44 8128 3161 38% 4864 4864 0 103
45 8128 3036 37% 4992 4992 0 100
45 8128 2906 35% 5120 5120 0 102
46 8128 2905 35% 5120 4992 128 103
46 8128 2903 35% 5120 4864 256 105
....
65 8128 855 10% 7168 4096 3072 105
66 8128 731 8% 7296 4224 3072 101
66 8128 601 7% 7424 4352 3072 103
67 8128 471 5% 7552 4480 3072 105
67 8128 347 4% 4608 4608 0 3173
68 8128 217 2% 4736 4736 0 3175
68 8128 3164 38% 4864 4864 0 100
69 8128 3034 37% 4992 4992 0 102
69 8128 2905 35% 5120 5120 0 103
70 8128 2903 35% 5120 4992 128 105
70 8128 2901 35% 5120 4864 256 107
....
89 8128 855 10% 7168 4096 3072 105
90 8128 731 8% 7296 4224 3072 101
90 8128 601 7% 7424 4352 3072 103
91 8128 471 5% 7552 4480 3072 105
91 8128 347 4% 4608 4608 0 3173
92 8128 217 2% 4736 4736 0 3175
92 8128 3164 38% 4864 4864 0 100
93 8128 3034 37% 4992 4992 0 102
93 8128 2905 35% 5120 5120 0 103
94 8128 2903 35% 5120 4992 128 105
94 8128 2901 35% 5120 4864 256 107
95 8128 2899 35% 5120 4736 384 109
95 8128 2897 35% 5120 4608 512 111
....
One thing different in JDK 1.3.1 is that the memory recovered by the
garbage collector at second 67 was not immediately given to the application
as free memory until second 68.
It seemed to me that JDK 1.3.1 had a better garbage collection process. So
I tried two tests with higher memory requirements:
java -Xms2m -Xmx8m GCTest 16 32 > tail_16_32.out
java -Xms2m -Xmx8m GCTest 16 40 > tail_16_40.out
Amazingly, both tests ran to the end without any problem.
Let's look at tail_16_40.out:
Time Total Free Free Total Act. Dead Over
sec. Mem. Mem. Per. Obj. Obj. Obj. Head
0 1984 1815 91% 0 0 0 169
1 1984 1682 84% 128 128 0 174
....
20 5484 390 7% 4992 4992 0 102
21 5484 260 4% 5120 5120 0 104
21 8128 2780 34% 5248 5248 0 100
22 8128 2652 32% 5376 5376 0 100
....
49 8128 731 8% 7296 2176 5120 101
50 8128 601 7% 7424 2304 5120 103
50 8128 471 5% 7552 2432 5120 105
51 8128 347 4% 2560 2560 0 5221
51 8128 217 2% 2688 2688 0 5223
52 8128 4957 60% 2816 2816 0 355
52 8128 4828 59% 2944 2944 0 356
53 8128 4698 57% 3072 3072 0 358
....
89 8128 530 6% 7168 2048 5120 430
90 8128 400 4% 7296 2176 5120 432
90 8128 270 3% 7424 2304 5120 434
91 8128 475 5% 2432 2432 0 5221
91 8128 345 4% 2560 2560 0 5223
92 8128 215 2% 2688 2688 0 5225
92 8128 5213 64% 2816 2816 0 99
93 8128 5084 62% 2944 2944 0 100
93 8128 4954 60% 3072 3072 0 102
....
129 8128 785 9% 7168 2048 5120 175
130 8128 655 8% 7296 2176 5120 177
130 8128 526 6% 7424 2304 5120 178
131 8128 475 5% 2432 2432 0 5221
131 8128 345 4% 2560 2560 0 5223
132 8128 215 2% 2688 2688 0 5225
132 8128 5213 64% 2816 2816 0 99
133 8128 5084 62% 2944 2944 0 100
133 8128 4954 60% 3072 3072 0 102
....
169 8128 785 9% 7168 2048 5120 175
170 8128 655 8% 7296 2176 5120 177
170 8128 526 6% 7424 2304 5120 178
171 8128 475 5% 2432 2432 0 5221
171 8128 345 4% 2560 2560 0 5223
172 8128 215 2% 2688 2688 0 5225
172 8128 5213 64% 2816 2816 0 99
173 8128 5084 62% 2944 2944 0 100
173 8128 4954 60% 3072 3072 0 102
....
As you can see, the the garbage collector worked perfectly.
(Continued on next part...)
Part:
1
2
3
4
5
6
7
8
9
|