testLeakBrokenHint() — netty Function Reference
Architecture documentation for the testLeakBrokenHint() function in ResourceLeakDetectorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD cd45a9fe_3d5b_c674_1444_9b2369e80678["testLeakBrokenHint()"] b9315c3d_21bb_7c58_f151_90c8040eed69["ResourceLeakDetectorTest"] cd45a9fe_3d5b_c674_1444_9b2369e80678 -->|defined in| b9315c3d_21bb_7c58_f151_90c8040eed69 57aeb634_0e1f_2f43_bfbc_c001da533bd3["initialise()"] cd45a9fe_3d5b_c674_1444_9b2369e80678 -->|calls| 57aeb634_0e1f_2f43_bfbc_c001da533bd3 9e543dfe_5122_4300_2978_1c4fe82e51f6["leakResource()"] cd45a9fe_3d5b_c674_1444_9b2369e80678 -->|calls| 9e543dfe_5122_4300_2978_1c4fe82e51f6 70f8812a_9703_dba6_5d96_f3220a8fb1ec["getLeaksFound()"] cd45a9fe_3d5b_c674_1444_9b2369e80678 -->|calls| 70f8812a_9703_dba6_5d96_f3220a8fb1ec 40cbe14c_de4c_aa61_37d9_4da04da1e233["close()"] cd45a9fe_3d5b_c674_1444_9b2369e80678 -->|calls| 40cbe14c_de4c_aa61_37d9_4da04da1e233 bea399c2_041c_146d_4bb8_c499ee67b437["assertNoErrors()"] cd45a9fe_3d5b_c674_1444_9b2369e80678 -->|calls| bea399c2_041c_146d_4bb8_c499ee67b437 style cd45a9fe_3d5b_c674_1444_9b2369e80678 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/test/java/io/netty/util/ResourceLeakDetectorTest.java lines 130–164
@Timeout(10)
@Test
public void testLeakBrokenHint() throws Throwable {
DefaultResource.detectorWithSetupHint.initialise();
DefaultResource.detectorWithSetupHint.failOnUntraced = false;
DefaultResource.detectorWithSetupHint.initialHint = new ResourceLeakHint() {
@Override
public String toHintString() {
throw new RuntimeException("expected failure");
}
};
try {
leakResource();
fail("expected failure");
} catch (RuntimeException e) {
assertThat(e.getMessage()).isEqualTo("expected failure");
}
DefaultResource.detectorWithSetupHint.initialHint = DefaultResource.detectorWithSetupHint.canaryString;
do {
// Trigger GC.
System.gc();
// Track another resource to trigger refqueue visiting.
Resource resource2 = new DefaultResource();
DefaultResource.detectorWithSetupHint.track(resource2).close(resource2);
// Give the GC something to work on.
for (int i = 0; i < 1000; i++) {
sink = System.identityHashCode(new byte[10000]);
}
} while (DefaultResource.detectorWithSetupHint.getLeaksFound() < 1 && !Thread.interrupted());
assertThat(DefaultResource.detectorWithSetupHint.getLeaksFound()).isOne();
DefaultResource.detectorWithSetupHint.assertNoErrors();
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testLeakBrokenHint() do?
testLeakBrokenHint() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/ResourceLeakDetectorTest.java.
Where is testLeakBrokenHint() defined?
testLeakBrokenHint() is defined in common/src/test/java/io/netty/util/ResourceLeakDetectorTest.java at line 130.
What does testLeakBrokenHint() call?
testLeakBrokenHint() calls 5 function(s): assertNoErrors, close, getLeaksFound, initialise, leakResource.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free