Surfaced by SonarQube (api.spikersoft.com), rule csharpsquid:S1215, severity CRITICAL (MAINTAINABILITY). Manual GC.Collect() forces full collections that usually hurt throughput/latency and mask the real issue (e.g. large allocations, undisposed resources).
Surfaced by SonarQube (`api.spikersoft.com`), rule `csharpsquid:S1215`, severity CRITICAL (MAINTAINABILITY). Manual `GC.Collect()` forces full collections that usually hurt throughput/latency and mask the real issue (e.g. large allocations, undisposed resources).
## Locations
- `SpikerSoft.Business.Ai.Workers/Services/QuizGenerationService.cs:144, 344, 731, 733`
- `SpikerSoft.EventHandlers.Embeddings/Services/EmbeddingGenerationService.cs:157, 175, 249, 251`
## Fix
Remove the calls; if memory pressure is real, address allocations directly (stream/chunk, dispose, pool buffers) rather than forcing GC.
_Rule: https://rules.sonarsource.com/csharp/RSPEC-1215/_
Resolved in spikersoft-backend PR #12 (merged to master). Note the approach differs from the ticket's "remove": the GC.Collect calls run only on LLama model-unload paths (QuizGenerationService, EmbeddingGenerationService) to promptly reclaim native/GPU memory the managed GC can't see — removing them risks OOM on the next model load. So S1215 is suppressed file-wide with a documented justification rather than deleting the calls. Closing.
Resolved in spikersoft-backend PR #12 (merged to `master`). Note the approach differs from the ticket's "remove": the `GC.Collect` calls run only on LLama model-unload paths (`QuizGenerationService`, `EmbeddingGenerationService`) to promptly reclaim native/GPU memory the managed GC can't see — removing them risks OOM on the next model load. So `S1215` is suppressed file-wide with a documented justification rather than deleting the calls. Closing.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Surfaced by SonarQube (
api.spikersoft.com), rulecsharpsquid:S1215, severity CRITICAL (MAINTAINABILITY). ManualGC.Collect()forces full collections that usually hurt throughput/latency and mask the real issue (e.g. large allocations, undisposed resources).Locations
SpikerSoft.Business.Ai.Workers/Services/QuizGenerationService.cs:144, 344, 731, 733SpikerSoft.EventHandlers.Embeddings/Services/EmbeddingGenerationService.cs:157, 175, 249, 251Fix
Remove the calls; if memory pressure is real, address allocations directly (stream/chunk, dispose, pool buffers) rather than forcing GC.
Rule: https://rules.sonarsource.com/csharp/RSPEC-1215/
Resolved in spikersoft-backend PR #12 (merged to
master). Note the approach differs from the ticket's "remove": theGC.Collectcalls run only on LLama model-unload paths (QuizGenerationService,EmbeddingGenerationService) to promptly reclaim native/GPU memory the managed GC can't see — removing them risks OOM on the next model load. SoS1215is suppressed file-wide with a documented justification rather than deleting the calls. Closing.