Bug in G1GC it performs Full GC when code cache is full resulting in overkill

Martin Makundi martin.makundi at koodaripalvelut.com
Mon Jun 10 05:22:57 PDT 2013


>> Regarding bytecode rewriting, I found
>> https://code.google.com/p/java-allocation-instrumenter/ which on the
>> front page already gives an example for almost what you want to achieve.
>
> Thanks, this seems to work, will try that to see how it impacts and
> what we can find out. The first large object we found was a
> stringbuilder from a logger that collects stacktraces to dump them
> optionally after a certain timeout... need to redesign that up front
> ;)

Interesting, my allocationrecorder did not catch the allocation:

      AllocationRecorder.addSampler(new Sampler() {
        @Override
        public void sampleAllocation(int count, String name, Object
newObj, long size) {
          if (Bytes.megabytes(30).bytes() < size) {
            Utils.errorLog(Sampler.class, "I just allocated the object
" + newObj + " of type " + name + " whose size is "
                + Bytes.bytes(size).megabytes() + " megabytes" +
((count != -1) ? (" and it is an array of size " + count) : ""));
          }
        }
      });

While gc log says:

 28787.582: [G1Ergonomics (Heap Sizing) attempt heap expansion,
reason: humongous allocation request failed, allocation request:
58720272 bytes]
 28787.582: [G1Ergonomics (Heap Sizing) expand the heap, requested
expansion amount: 58720256 bytes, attempted expansion amount: 58720256
bytes]
 28787.582: [G1Ergonomics (Heap Sizing) did not expand the heap,
reason: heap expansion operation failed]
 28787.585: [G1Ergonomics (Heap Sizing) attempt heap expansion,
reason: humongous allocation request failed, allocation request:
58720272 bytes]
 28787.585: [G1Ergonomics (Heap Sizing) expand the heap, requested
expansion amount: 58720256 bytes, attempted expansion amount: 58720256
bytes]
 28787.585: [G1Ergonomics (Heap Sizing) did not expand the heap,
reason: heap expansion operation failed]
 28787.585: [G1Ergonomics (Heap Sizing) attempt heap expansion,
reason: allocation request failed, allocation request: 58720272 bytes]
 28787.585: [G1Ergonomics (Heap Sizing) expand the heap, requested
expansion amount: 58720272 bytes, attempted expansion amount: 67108864
bytes]
 28787.585: [G1Ergonomics (Heap Sizing) did not expand the heap,
reason: heap expansion operation failed]
{Heap before GC invocations=774 (full 231):
 garbage-first heap   total 31457280K, used 22000762K
[0x00007fdbf7800000, 0x00007fe377800000, 0x00007fe377800000)
  region size 8192K, 69 young (565248K), 69 survivors (565248K)
 compacting perm gen  total 524288K, used 169935K [0x00007fe377800000,
0x00007fe397800000, 0x00007fe397800000)
   the space 524288K,  32% used [0x00007fe377800000,
0x00007fe381df3e28, 0x00007fe381df4000, 0x00007fe397800000)
No shared spaces configured.
2013-06-10T14:25:52.166+0300: 28787.585: [Full GC
21485M->17350M(30720M), 67.3563480 secs]
 [Times: user=96.62 sys=0.15, real=67.34 secs]
Heap after GC invocations=775 (full 232):
 garbage-first heap   total 31457280K, used 17766944K
[0x00007fdbf7800000, 0x00007fe377800000, 0x00007fe377800000)
  region size 8192K, 0 young (0K), 0 survivors (0K)
 compacting perm gen  total 524288K, used 169935K [0x00007fe377800000,
0x00007fe397800000, 0x00007fe397800000)
   the space 524288K,  32% used [0x00007fe377800000,
0x00007fe381df3e28, 0x00007fe381df4000, 0x00007fe397800000)
No shared spaces configured.
}

Does this make sense?

**
Martin


More information about the hotspot-gc-use mailing list