Garbage collection is requested explicitly
What it finds
System.gc() asks the virtual machine for a full collection, which pauses the program for a while and usually does worse than the collector's own scheduling. It is a hint at best and is often turned off.
From the rule's source, explicit_gc.rs.
fun free() { System.gc()tx0 reports: an explicit garbage collection Runtime.getRuntime().gc()tx0 reports: an explicit garbage collection cache.gc()} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/kotlin:explicit-garbage-collection" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/kotlin:explicit-garbage-collection] reason="..."tx0 explain tx0/kotlin:explicit-garbage-collection shows the same in the terminal. Found a false positive? Report it.