Use forbiddenapis to block explicit GCs [LUCENE-8814]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Explicit GCs should not be allowed in production code.
We do have a number of System.gc() calls in Lucene and Solr tests, and in the Lucene benchmark.
I intend to block System.gc() and Runtime.gc() in the forbidden APIs configuration. As part of that, I need to know whether the explicit calls in the test and benchmark code should be left there and allowed with SuppressForbidden, or if we should remove them. My general thought is that production code will most likely not be doing explicit GCs, so tests shouldn't be doing it either ... but I didn't design those tests, so I can't claim to know the intent.
---
Migrated from [LUCENE-8814](https://issues.apache.org/jira/browse/LUCENE-8814) by Shawn Heisey (@elyograg)
Contributor guide
Research direction
Start with the forbidden APIs configuration and locate the System.gc() and Runtime.gc() calls mentioned in Lucene and Solr tests and the Lucene benchmark. Determine whether those calls should be removed or explicitly suppressed, then verify that explicit GCs are blocked in production code and the affected tests and benchmark still behave as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100