Scott Gray wrote:
> Yeah +1 from me, I just wanted to make sure we had some tangible
> benefits in mind and I didn't really see the dbcp library problem we had
> as being a good reason for the switch since it was easily resolved.

Plus 1.6 hotspot is wicked smarter, and faster.
==
void foo() {
        Object[] array = new Object[6];
        ...
        bar(array);
        ...
        return
}

void bar(Object[] array) {
        System.err.println(Arrays.toString(array));
}
==

Before java 1.6, array would be allocated on the heap, which requires
cross-thread locking, to ensure consistency.

In java 1.6, after appropriate jitting, it can detect that array never
leaves the any of the method scopes, so actually converts it to
allocate *on the stack*.  This means allocation and the eventual
deallocation is *wicked* fast.

This feature is called escape analysis.

Reply via email to