Memory and goroutine leaks in long-running embedded engine usage
Type: Bug
## Summary
The embedded engine can leak memory and goroutines over time during long-running usage.
## Required changes
Implement the leak-prevention work described in #7502:
- bound the `HTTPToHTTPS` tracker with an LRU
- release the per-host rate-limit pool goroutines on close
- purge the template caches on engine close
## Rationale
Without explicit cleanup and bounded caching, long-running embedders can accumulate memory usage and leave background goroutines running indefinitely.
## Affected areas
- `HTTPToHTTPS` tracking / redirect bookkeeping
- per-host rate limit pool lifecycle and shutdown
- template cache lifecycle during engine close
## Acceptance criteria
- The `HTTPToHTTPS` tracker is size-bounded and evicts old entries.
- Per-host rate-limit pool goroutines are released when the engine closes.
- Template caches are purged on engine close.
- Long-running embedded usage no longer shows continued growth from these resources.
## Backlinks
- Pull request: https://github.com/projectdiscovery/nuclei/pull/7502
- Request comment: https://github.com/projectdiscovery/nuclei/pull/7502#issuecomment-4794470056
- Requested by: @Mzack9999
## Additional context
PR title: fix leaks
0 条评论