Review Request: JDK-8193159: Reduce the number of classes loaded due to NativeLibrary

Alan Bateman Alan.Bateman at
Thu Dec 7 13:39:36 UTC 2017

On 07/12/2017 05:04, mandy chung wrote:
> On 12/6/17 6:08 PM, Martin Buchholz wrote:
>> Google decided that LinkedList is almost never the best choice, so 
>> any use of LinkedList is discouraged.
>> ArrayDeque's backing array never shrinks, so you might want to give 
>> it an explicit initial size.
> The initial size is 16 which is okay.  I can make it smaller instead:
> -        static Deque<NativeLibrary> nativeLibraryContext = new 
> LinkedList<>();
> +        static Deque<NativeLibrary> nativeLibraryContext = new 
> ArrayDeque<>(8);
This looks okay. It seems unlikely that hundreds of native libraries 
will be loaded, then unloaded, and the backing array being a memory concern.


More information about the core-libs-dev mailing list