GeezerVison is showing github.com — Refactor state handling in AdaptivePoolingAllocator to simplify deall… · netty/netty@674ce6b
File tree
Expand file treeCollapse file tree
Open diff view settings
buffer/src/main/java/io/netty/buffer
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java +3-7Lines changed: 3 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1390,17 +1390,13 @@ void releaseSegment(int startIndex, int size) { |
1390 | 1390 | // implicit StoreLoad barrier from MPSC offer() |
1391 | 1391 | int state = this.state; |
1392 | 1392 | if (state != AVAILABLE) { |
1393 | | - handleStateOnExternalReleaseSegment(state); |
| 1393 | + // localFreeListSize is the number of segments that were in the local free list when |
| 1394 | + // markToDeallocate() was called. Check if all segments have been returned. |
| 1395 | + deallocateIfNeeded(state); |
1394 | 1396 | } |
1395 | 1397 | } |
1396 | 1398 | } |
1397 | 1399 |
|
1398 | | - private void handleStateOnExternalReleaseSegment(int localFreeListSize) { |
1399 | | - // localFreeListSize is the number of segments that were in the local free list when |
1400 | | - // markToDeallocate() was called. Check if all segments have been returned. |
1401 | | - deallocateIfNeeded(localFreeListSize); |
1402 | | - } |
1403 | | - |
1404 | 1400 | private void updateStateOnLocalReleaseSegment(int previousLocalSize, IntStack localFreeList) { |
1405 | 1401 | // Update the state to reflect the new local free list size. |
1406 | 1402 | int newLocalSize = localFreeList.size(); |
|