OutOfMemoryError (on GCOverheadLimit)
Jon Masamitsu
jon.masamitsu at oracle.com
Thu Jul 12 11:18:09 PDT 2012
For CMS the determination to throw an OOME for
excessive GC overhead is only done at
a Full GC. Assuming there are no allocations in your loop,
you won't get an OOME in it. Looking at the code
I don't think G1 supports this type of OOME.
Jon
On 07/12/12 09:40, Florian Binder wrote:
> Hi Everyone,
>
> I have seen an OutOfMemoryError can be thrown even if there would be
> enough space for the allocation (if it takes more than 98% of time or
> something like this).
>
> But the javadoc of OutOfMemoryError says:
> "Thrown when the Java Virtual Machine cannot allocate an object because
> it is out of memory, and no more memory could be made available by the
> garbage collector."
>
> Therefore I thought an OutOfMemoryError can only be thrown if memory is
> allocated.
>
> For the serial and parallel gc this is no problem, because the gc is
> only triggered on object allocations. But what is with the CMS or G1?
> When do they throw the OOME if the OverheadLimit is reached? On the next
> object allocation or immidiately (interrupting the thread[s] at any
> position)? And which Thread is getting the OOME? Only one, or all?
>
> The reason for these questions is that I would like to know if OOME can
> be thrown only on object allocation or anytime.
>
> Is it possible that the following method throws an OOME?:
> public int sumAll(int[] data) {
> int sum = 0;
> for(int i = 0; i< data.length; i++) {
> sum += data[i];
> }
> return sum;
> }
>
> Thanks,
> Flo
> _______________________________________________
> hotspot-gc-use mailing list
> hotspot-gc-use at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
More information about the hotspot-gc-use
mailing list