;>
>>>>>>>>>> Hi Martin,
>>>>>>>>>>
>>>>>>>>>> Thank you for your reply. If I may, PriorityQueue appears to
>>>>>>>>>> employ
>>>>>>>>>> the
bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable
and
java.io.ByteArrayOutputStream which arise when the capacities
of the
data
structures reach a particular threshold. More below.
When the ca
something near
MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
These bugs are not known.
Chris Hegarty, could you file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
java.io
t; It might be desirable to set a common strategy for capacity increase
>>>>>>> for
>>>>>>> all
>>>>>>> collections.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>>
gt;>>>
>>>>>> Kevin
>>>>>>
>>>>>> On Fri, Mar 5, 2010 at 3:04 AM, Martin Buchholz
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Kevin,
>>>>>>>
>>>>
AX_VALUE on overflow, and throw OutOfMemoryError on next
resize.
These bugs are not known.
Chris Hegarty, could you file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern >
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable
and
java.io
near
MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
These bugs are not known.
Chris Hegarty, could you file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
java.io.ByteArrayOutpu
On Fri, Apr 16, 2010 at 03:17, David Holmes wrote:
> Hi Martin,
>
> Martin Buchholz said the following on 04/16/10 16:09:
>>
>> I recently discovered another place to handle huge arrays better - in
>> AbstractCollection.
>> I've put those changes into
>> http://cr.openjdk.java.net/~martin/webrevs/
ar
MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
These bugs are not known.
Chris Hegarty, could you file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
java.io.ByteA
41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
java.io.ByteArrayOutputStream which arise when the capacities of the
data
structures reach a particular threshold. More below.
When the capacity of an ArrayList reaches (2/3)*Integer.MAX_
an independent buglet in hotspot
>>>> that you cannot allocate an array with Integer.MAX_VALUE
>>>> elements, but Integer.MAX_VALUE - 5 (or so) works.
>>>>
>>>> It occurs to me that increasing the size by 50% is better done by
>>>> int new
at you cannot allocate an array with Integer.MAX_VALUE
>> >> elements, but Integer.MAX_VALUE - 5 (or so) works.
>> >>
>> >> It occurs to me that increasing the size by 50% is better done by
>> >> int newCapacity = oldCapacity + (oldCapacity >> 1)
On Wed, Mar 10, 2010 at 09:36, Ulf Zibis wrote:
> Am 10.03.2010 00:22, schrieb Martin Buchholz:
>>
>> On Tue, Mar 9, 2010 at 15:11, Ulf Zibis wrote:
>>
>>
>>>
>>> Can you explain the mystery about "+ 2" ?
>>>
>>
>> It's exactly the same as the old resizing behavior.
>
> In detail I meant, if you
Am 10.03.2010 00:22, schrieb Martin Buchholz:
On Tue, Mar 9, 2010 at 15:11, Ulf Zibis wrote:
Can you explain the mystery about "+ 2" ?
It's exactly the same as the old resizing behavior.
In detail I meant, if you have any idea, why the original designers
could have chosen the "+1
50% is better done by
> >> int newCapacity = oldCapacity + (oldCapacity >> 1) + 1;
> >>
> >> I agree with the plan of setting the capacity to something near
> >> MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
> >>
> >> T
On Tue, Mar 9, 2010 at 15:11, Ulf Zibis wrote:
> Can you explain the mystery about "+ 2" ?
It's exactly the same as the old resizing behavior.
Martin
Am 09.03.2010 23:08, schrieb Martin Buchholz:
On Tue, Mar 9, 2010 at 13:08, Ulf Zibis wrote:
[1] current PriorityQueue snippet:
...
int newCapacity = ((oldCapacity< 64)?
((oldCapacity + 1) * 2):
((oldCapacity / 2) * 3));
...
On Tue, Mar 9, 2010 at 13:08, Ulf Zibis wrote:
>
> [1] current PriorityQueue snippet:
> ...
> int newCapacity = ((oldCapacity < 64)?
> ((oldCapacity + 1) * 2):
> ((oldCapacity / 2) * 3));
> ...
> [2] new PriorityQueue snippet:
> ...
>
Am 09.03.2010 21:02, schrieb Osvaldo Doederlein:
Should we really consider this a VM bug? I'm not sure that it's a good
idea to allocate a single object which size exceeds 4Gb (for a byte[]
- due to the object header and array size field) - even on a 64-bit
VM. An array with 2^32 elements is im
Am 09.03.2010 20:18, schrieb Martin Buchholz:
On Tue, Mar 9, 2010 at 03:59, Ulf Zibis wrote:
In PriorityQueue:
let's result newCapacity in 0x.FFFC =-4
then "if (newCapacity - MAX_ARRAY_SIZE> 0)" ---> false
then Arrays.copyOf(queue, newCapacity) ---> ArrayIndexOutOfBoundsException
It surely is not a good idea to use a single backing array
for huge arrays. As you point out, it's up to 32GB
for just one object. But the core JDK
doesn't offer a suitable alternative for users who need very
large collections.
It would have been more in the spirit of Java to have a
collection c
ava spec, or will this break on an
>> obscure machine that does not use, say, two's complement arithmetic?
>>
>> Regards,
>>
>> Kevin
>>
>> 2010/3/9 Dmytro Sheyko
>>>
>>> Is there any reason to use comparison like this
Should we really consider this a VM bug? I'm not sure that it's a good idea
to allocate a single object which size exceeds 4Gb (for a byte[] - due to
the object header and array size field) - even on a 64-bit VM. An array with
2^32 elements is impossible, the maximum allowed by the size field is 2^
On Tue, Mar 9, 2010 at 03:59, Ulf Zibis wrote:
> In PriorityQueue:
>
> let's result newCapacity in 0x.FFFC =-4
> then "if (newCapacity - MAX_ARRAY_SIZE > 0)" ---> false
> then Arrays.copyOf(queue, newCapacity) ---> ArrayIndexOutOfBoundsException
How could newCapacity ever become -4?
Since gr
Am 09.03.2010 12:02, schrieb Kevin L. Stern:
I did a quick search and it appears that Java is indeed two's
complement based. Nonetheless, please allow me to point out that, in
general, this type of code worries me since I fully expect that at
some point someone will come along and do exactly w
>> Kevin
>>
>> 2010/3/9 Dmytro Sheyko
>>
>> Is there any reason to use comparison like this
>>>
>>> if (newCapacity - minCapacity < 0)
>>>
>>> if (newCapacity - MAX_ARRAY_SIZE > 0) {
>>>
>>> instead of
&
u file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
java.io.ByteArrayOutputStream which arise when the capacities of the
data
structures reach a particular threshold. More below.
When th
ZE > 0) {
>>
>> instead of
>>
>> if (newCapacity < minCapacity)
>>
>> if (newCapacity > MAX_ARRAY_SIZE) {
>>
>> Thanks,
>> Dmytro
>>
>> > Date: Mon, 8 Mar 2010 18:10:37 -0800
>> > Subject: Re: Bugs in java.u
ething near
MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
These bugs are not known.
Chris Hegarty, could you file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern
wrote:
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable an
here any reason to use comparison like this
>
> if (newCapacity - minCapacity < 0)
>
> if (newCapacity - MAX_ARRAY_SIZE > 0) {
>
> instead of
>
> if (newCapacity < minCapacity)
>
> if (newCapacity > MAX_ARRAY_SIZE) {
>
> Thanks,
> Dmytro
>
> >
bject: Re: Bugs in java.util.ArrayList, java.util.Hashtable and
> java.io.ByteArrayOutputStream
> From: marti...@google.com
> To: kevin.l.st...@gmail.com; christopher.hega...@sun.com; alan.bate...@sun.com
> CC: core-libs-dev@openjdk.java.net
>
> [Chris or Alan, please review and file
2010/3/5 :
> Hello,
>
> I'm using my own Collections if it's possible so I can add some thoughts:
>
> 1. I would decrease default array size to 4/6/8, for me it was few Mb more
> of free memory ( i suggest testing on application that use at least 300Mb)
>
> I would test:
>
> initial size: 4
> long
On Fri, Mar 5, 2010 at 02:48, Kevin L. Stern wrote:
> Hi Martin,
>
> Thank you for your reply. If I may, PriorityQueue appears to employ the
> simple strategy that I suggested above in its grow method:
>
> int newCapacity = ((oldCapacity < 64)?
> ((oldCapacity +
etter done by
>> int newCapacity = oldCapacity + (oldCapacity >> 1) + 1;
>>
>> I agree with the plan of setting the capacity to something near
>> MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
>>
>> These bugs are not known.
>
oldCapacity >> 1) + 1;
>
> I agree with the plan of setting the capacity to something near
> MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
>
> These bugs are not known.
> Chris Hegarty, could you file a bug for us?
>
> Martin
>
> On Wed, Mar 3, 2010
FYI, HashMap independently defines a MAXIMUM_CAPACITY variable; it might be
a good idea to retrofit this and other such local definitions with any
system wide variables that are defined.
/**
* The maximum capacity, used if a higher value is implicitly specified
* by either of the con
Am 05.03.2010 10:04, schrieb Martin Buchholz:
Hi Kevin,
As you've noticed, creating objects within a factor of two of
their natural limits is a good way to expose lurking bugs.
I'm the one responsible for the algorithm in ArrayList.
I'm a bit embarrassed, looking at that code today.
We could se
t;
wrote:
> Greetings,
>
> I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
> java.io.ByteArrayOutputStream which arise when the capacities of the
data
> structures reach a particular threshold. More below.
>
> When the capacity of an ArrayList r
1;
I agree with the plan of setting the capacity to something near
MAX_VALUE on overflow, and throw OutOfMemoryError on next resize.
These bugs are not known.
Chris Hegarty, could you file a bug for us?
Martin
On Wed, Mar 3, 2010 at 17:41, Kevin L. Stern wrote:
> Greetings,
>
> I've
Greetings,
I've noticed bugs in java.util.ArrayList, java.util.Hashtable and
java.io.ByteArrayOutputStream which arise when the capacities of the data
structures reach a particular threshold. More below.
When the capacity of an ArrayList reaches (2/3)*Integer.MAX_VALUE its size
reache
40 matches
Mail list logo