GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix buddy cache evicting chunks with live buffers (#17154) · netty/netty@34bfcc7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • buffer/src/main/java/io/netty/buffer
    • AdaptivePoolingAllocator.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java‎

Copy file name to clipboardExpand all lines: buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java
+4-15Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,25 +1088,14 @@ public boolean offerChunk(Chunk chunk) {
10881088

10891089
int size = chunks.size();
10901090
while (size > CHUNK_REUSE_QUEUE) {
1091-
// Deallocate the chunk with the fewest incoming references.
10921091
int key = -1;
10931092
Chunk toDeallocate = null;
10941093
for (IntEntry<Chunk> entry : chunks) {
10951094
Chunk candidate = entry.getValue();
1096-
if (candidate != null) {
1097-
if (toDeallocate == null) {
1098-
toDeallocate = candidate;
1099-
key = entry.getKey();
1100-
} else {
1101-
int candidateRefCnt = RefCnt.refCnt(candidate.refCnt);
1102-
int toDeallocateRefCnt = RefCnt.refCnt(toDeallocate.refCnt);
1103-
if (candidateRefCnt < toDeallocateRefCnt ||
1104-
candidateRefCnt == toDeallocateRefCnt &&
1105-
candidate.capacity() < toDeallocate.capacity()) {
1106-
toDeallocate = candidate;
1107-
key = entry.getKey();
1108-
}
1109-
}
1095+
if (candidate != null && RefCnt.refCnt(candidate.refCnt) == 1) {
1096+
toDeallocate = candidate;
1097+
key = entry.getKey();
1098+
break;
11101099
}
11111100
}
11121101
if (toDeallocate == null) {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.