{HandleArea* Thread::_handle_area} is used to store the Handles allocated during native code execution. The current allocation policy is:
initial allocation = 1 Kilo bytes (see the constant Chunk::init_size in allocation.hpp)
subsequent allocations = 32 Kilo Bytes (see the constant Chunk::size)
The 1KB allocation is too big. See attachments trace.patch, eclipse.handles.log, eclipse.handles.results and sum_trace_handle_allocation.tcl for complete statistics:
You can see 99.9% of the cases we use 33 handles or less, which means instead of using Chunk::init_size, we can safely use 256 bytes for the initial allocation with virtually no performance impact.
The original switch over point is 99.98%, which is only about 0.1% higher than the switch-over point for 256 bytes.
$ java -XX:+TraceHandleAllocation -jar $ECLIPSE64 2>&1 | tee eclipse.handles.log
$ tclsh ~/jdk/proj/ioisvn/scripts/sum_trace_handle_allocation.tcl < eclipse.handles.log | tee eclipse.handles.results
count accum perc
157934 157934 47.81% Handles 0, Chunks 0
100901 258835 78.36% Handles 1, Chunks 0
59379 318214 96.34% Handles 2, Chunks 0
3590 321804 97.43% Handles 3, Chunks 0
1344 323148 97.83% Handles 4, Chunks 0
2 323150 97.83% Handles 4, Chunks 1
1320 324470 98.23% Handles 5, Chunks 0
1 324471 98.23% Handles 5, Chunks 1
1305 325776 98.63% Handles 6, Chunks 0
2 325778 98.63% Handles 6, Chunks 1
632 326410 98.82% Handles 7, Chunks 0
628 327038 99.01% Handles 8, Chunks 0
...
114 329959 99.90% Handles 33, Chunks 0
...
1 330240 99.98% Handles 108, Chunks 0
1 330241 99.98% Handles 109, Chunks 1