java.lang.OutOfMemory

From bug 8549635:

As noted, the array in the testcase requires 500MB of memory. In OJVM (the
Java VM which runs in the RDBMS server), this memory must be contiguous and
is allocated from the RDBMS memory system (KGH), from the space known there
as PGA. The maximum allocation allowed in PGA is controlled by
the OSD function sskgmqprvtmaxalloc, for which the commentary says
We hardcode this to 64MB or 256MB, depending on the size of ubig_ora.
Note that this must be an exact multiple of skgmqprotectsize().

There isn’t much point in increasing this beyond 64MB for 32-bit
platforms, or 2GB for 64-bit platforms, since we can’t use kgh to
allocate anything larger than that.
So it is an Oracle/RDBMS restriction that no array that requires more than
256MB (or 64MB on 32bit platforms) can be allocated by OJVM. One
might think that it is a bug that OracleRuntime.getMaxMemorySize
doesn’t reflect this fact, but in fact that method refers to the
limit on the total amount of memory used by a part of the memory
manager, not the limit on individual object size.