[OpenJDK Rasterizer] [OpenJDK 2D-Dev] Path2d needRoom very slow for huge paths

Laurent Bourgès bourges.laurent at gmail.com
Fri Apr 3 13:37:42 UTC 2015


Sergey,

2015-04-03 15:16 GMT+02:00 Sergey Bylokhov <Sergey.Bylokhov at oracle.com>:

> Hello.
> Is that a problem that with the new code we can get OOM earlier in some
> cases? Should we take care of overflow more carefully now? It seems that
> ArrayList.grow contains similar logic.
>
>
I advocate I did not test with a small heap (Xmx32m ...)

I agree my patch will waste more memory : 1/8th for both arrays (byte[] and
float or double[]) instead of 500 byte and 1000 float/double values !

I looked at ArrayList.grow(int) and it deals with integer overflow ie
Integer.MAX_VALUE ... I did not imagine such big paths !

But you're right: my code can be improved to deal with OOME and overflow.

In case of OOME, it may be possible to try allocating another array with a
smaller grow ?
Is it what you had in mind ?

Cheers,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/attachments/20150403/507bfddf/attachment.html>


More information about the graphics-rasterizer-dev mailing list