Re: Bugs in java.util.ArrayList, java.util.Hashtable and java.io.ByteArrayOutputStream

2010-03-05 Thread 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 set the array size to Integer.MAX_VALUE, but then

Re: Re: Bugs in java.util.ArrayList, java.util.Hashtable and java.io.ByteArrayOutputStream

2010-03-05 Thread develop4lasu
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 newCapacity = ((long)oldC

Re: Bugs in java.util.ArrayList, java.util.Hashtable and java.io.ByteArrayOutputStream

2010-03-05 Thread Ulf Zibis
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

Re: Bugs in java.util.ArrayList, java.util.Hashtable and java.io.ByteArrayOutputStream

2010-03-05 Thread Kevin L. Stern
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

Re: Bugs in java.util.ArrayList, java.util.Hashtable and java.io.ByteArrayOutputStream

2010-03-05 Thread Kevin L. Stern
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 + 1) * 2): ((oldCapacity / 2) * 3));

hg: jdk7/tl/langtools: 2 new changesets

2010-03-05 Thread jonathan . gibbons
Changeset: a23282f17d0b Author:jjg Date: 2010-03-05 16:12 -0800 URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/a23282f17d0b 6930108: IllegalArgumentException in AbstractDiagnosticFormatter for tools/javac/api/TestJavacTaskScanner.jav Reviewed-by: darcy ! src/share/classes/c