RFR: 8234328: VectorSet::clear can cause fragmentation

Claes Redestad claes.redestad at oracle.com
Thu Nov 21 13:21:31 UTC 2019


Hi Thomas,

On 2019-11-19 20:31, Thomas Stüfe wrote:
> Hi Claes,
> 
> Not that this is wrong, but do we have to live in resource area? I fell 
> over such problems several times already, e.g. with resource-area-backed 
> StringStreams. Maybe it would be better to just forbid resizing of 
> RA-allocated arrays altogether.

this all gets a bit out of scope, but what alternatives do you see to
living in the resource area in general for something like this?

> 
> Then there is also the problem with passing RA-allocated arrays down the 
> stack and accidentally resizing them under a different ResourceMark. I 
> am not sure if this could happen with VectorSet though.

AFAICT there's a ResourceMark at the entry point of compilation,
then all others are restricted to a local scope around logging and
similar, so it doesn't _look_ like there's any potential issues around.

I guess it'd be nice in general with some sort of debug-only
ProhibitResourceMark(Arena*) you could wrap around calls into utilities
out of your control which would assert if any code tries to
allocate/reallocate/free in a specific resource arena.

Thanks /Claes

> 
> Thanks, Thomas
> 
> On Tue, Nov 19, 2019 at 11:16 AM Claes Redestad 
> <claes.redestad at oracle.com <mailto:claes.redestad at oracle.com>> wrote:
>     Webrev: http://cr.openjdk.java.net/~redestad/8234328/open.00/


More information about the hotspot-compiler-dev mailing list