You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "dweiss (via GitHub)" <gi...@apache.org> on 2025/08/15 07:31:59 UTC
[PR] Add cleaner asserts to track unreleased RefCountedSharedArenas. [lucene]
dweiss opened a new pull request, #15077:
URL: https://github.com/apache/lucene/pull/15077
This is not supposed to be merged. Should help with #15068
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Add cleaner asserts to track unreleased RefCountedSharedArenas. [lucene]
Posted by "uschindler (via GitHub)" <gi...@apache.org>.
uschindler commented on code in PR #15077:
URL: https://github.com/apache/lucene/pull/15077#discussion_r2278502313
##########
lucene/core/src/java/org/apache/lucene/store/RefCountedSharedArena.java:
##########
@@ -49,6 +51,17 @@ final class RefCountedSharedArena implements Arena {
// acquire decrement; effectively decrements permits and increments ref count
private static final int ACQUIRE_DECREMENT = REMAINING_UNIT - 1; // 0xffff
+ /** True iff JVM assertions are enabled for this class. */
+ private static final boolean ASSERTS_ENABLED;
+
+ /** Cleaner only created when assertions are enabled (avoids overhead otherwise). */
+ private static final Cleaner CLEANER;
+
+ static {
+ ASSERTS_ENABLED = RefCountedSharedArena.class.desiredAssertionStatus();
Review Comment:
I'd prefer not to use that function and use the assert keyword to trigger this:
```
boolean enabled;
assert enabled = true;
ASSERTS_ENABLED = enabled;
```
##########
lucene/core/src/java/org/apache/lucene/store/RefCountedSharedArena.java:
##########
@@ -49,6 +51,17 @@ final class RefCountedSharedArena implements Arena {
// acquire decrement; effectively decrements permits and increments ref count
private static final int ACQUIRE_DECREMENT = REMAINING_UNIT - 1; // 0xffff
+ /** True iff JVM assertions are enabled for this class. */
+ private static final boolean ASSERTS_ENABLED;
+
+ /** Cleaner only created when assertions are enabled (avoids overhead otherwise). */
+ private static final Cleaner CLEANER;
+
+ static {
+ ASSERTS_ENABLED = RefCountedSharedArena.class.desiredAssertionStatus();
Review Comment:
I'd prefer not to use that function and use the assert keyword to trigger this:
```java
boolean enabled;
assert enabled = true;
ASSERTS_ENABLED = enabled;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Add cleaner asserts to track unreleased RefCountedSharedArenas. [lucene]
Posted by "dweiss (via GitHub)" <gi...@apache.org>.
dweiss closed pull request #15077: Add cleaner asserts to track unreleased RefCountedSharedArenas.
URL: https://github.com/apache/lucene/pull/15077
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org