Details
-
Improvement
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
3.3.0
-
None
Description
HeapMemoryAllocator initializes the new element ofbufferPoolsBySizein the following way:
synchronized (this) { LinkedList<WeakReference<long[]>> pool = bufferPoolsBySize.get(alignedSize); if (pool == null) { pool = new LinkedList<>(); bufferPoolsBySize.put(alignedSize, pool); } pool.add(new WeakReference<>(array)); }
The codes can be simplified by Map.computeIfAbsent