rmuir commented on code in PR #816: URL: https://github.com/apache/lucene/pull/816#discussion_r852294751
########## lucene/core/src/java/org/apache/lucene/util/CloseableThreadLocal.java: ########## @@ -123,12 +121,27 @@ public void close() { // Clear the hard refs; then, the only remaining refs to // all values we were storing are weak (unless somewhere // else is still using them) and so GC may reclaim them: - hardRefs = null; - // Take care of the current thread right now; others will be - // taken care of via the WeakReferences. - if (t != null) { - t.remove(); + perThreadValues = null; Review Comment: Can we be a bit more friendly, instead of just nulling the reference in close? We can empty the map. Something like (being friendly to closeable): ``` var values = perThreadValues; if (values != null) { values.clear(); } perThreadValues = null; ``` -- 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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org