Sergey,

2015-04-03 15:16 GMT+02:00 Sergey Bylokhov <sergey.bylok...@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

Reply via email to