Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/filtering/filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"os"
"path/filepath"
"runtime"
"runtime/debug"
"slices"
"strings"
"sync"
Expand Down Expand Up @@ -770,9 +769,11 @@ func (d *DNSFilter) initFiltering(ctx context.Context, allowFilters, blockFilter
d.filteringEngineAllow = filteringEngineAllow
}()

// Make sure that the OS reclaims memory as soon as possible.
debug.FreeOSMemory()

// NOTE: Don't call debug.FreeOSMemory here. It forces a full
// stop-the-world GC and returns all free memory to the OS, which causes a
// sudden CPU and I/O spike that can hang or crash the process right after
// a settings change, on any host. The Go runtime scavenger already
// returns memory to the OS gradually without the spike.
d.logger.DebugContext(ctx, "initialized filtering engine")

return nil
Expand Down