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 — Fill MsgHdrMemoryArray#hdrs with null entry on release · netty/netty@65ae8e4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • transport-classes-io_uring/src/main/java/io/netty/channel/uring
    • MsgHdrMemoryArray.java
  • transport-native-io_uring/src/test/java/io/netty/channel/uring
    • MsgHdrMemoryArrayTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎transport-classes-io_uring/src/main/java/io/netty/channel/uring/MsgHdrMemoryArray.java‎

Copy file name to clipboardExpand all lines: transport-classes-io_uring/src/main/java/io/netty/channel/uring/MsgHdrMemoryArray.java
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ int length() {
8585
void release() {
8686
assert !released;
8787
released = true;
88-
for (MsgHdrMemory hdr: hdrs) {
89-
hdr.release();
90-
}
88+
Arrays.fill(hdrs, null);
9189
msgHdrMemoryArrayMemoryCleanable.clean();
9290
}
9391

Collapse file

‎transport-native-io_uring/src/test/java/io/netty/channel/uring/MsgHdrMemoryArrayTest.java‎

Copy file name to clipboard
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2025 The Netty Project
3+
*
4+
* The Netty Project licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
package io.netty.channel.uring;
17+
18+
import org.junit.jupiter.api.BeforeAll;
19+
import org.junit.jupiter.api.Test;
20+
21+
import static org.junit.jupiter.api.Assertions.assertNotNull;
22+
import static org.junit.jupiter.api.Assertions.assertNull;
23+
import static org.junit.jupiter.api.Assumptions.assumeTrue;
24+
25+
public class MsgHdrMemoryArrayTest {
26+
27+
@BeforeAll
28+
public static void loadJNI() {
29+
assumeTrue(IoUring.isAvailable());
30+
}
31+
32+
@Test
33+
void releaseNullsHdrEntriesToAllowGarbageCollection() {
34+
short capacity = 4;
35+
MsgHdrMemoryArray array = new MsgHdrMemoryArray(capacity);
36+
for (int i = 0; i < capacity; i++) {
37+
assertNotNull(array.hdr(i));
38+
}
39+
array.release();
40+
for (int i = 0; i < capacity; i++) {
41+
assertNull(array.hdr(i));
42+
}
43+
}
44+
}

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.