RFR: 8170812: Metaspace corruption caused by incorrect memory size for MethodCounters

Thomas Stüfe thomas.stuefe at gmail.com
Thu Apr 6 13:02:38 UTC 2017


Hi Andrew,

On Thu, Apr 6, 2017 at 12:57 PM, Andrew Haley <aph at redhat.com> wrote:

> On 06/04/17 11:35, Thomas Stüfe wrote:
> >
> > I think it would make sense. From what I can see, the following methods
> are affected:
> >
> > ConstantPool::header_size()
>
> Not this one, because the declaration of ConstantPoolCache is
>
>   int             _length;
>   ConstantPool*   _constant_pool;          // the corresponding constant
> pool
>
> The size of this declaration must be a multiple of wordSize
> because the fields must be allocated in order, they must be
> aligned, and _constant_pool comes last.
>
> It's very confusing code, but not actually a bug, IMO.
>
>
I am confused:

ConstantPool::header_size() is used by ConstantPool::size(len), which in
turn is used in ConstantPool::allocate() to allocate space for a
ConstantPool. header_size() may be too small, and so the space allocated
for the whole ConstantPool plus data may be too small, no?

..Thomas



> Andrew.
>
>


More information about the hotspot-dev mailing list