optimize(memory): reuse kernel lpm tries in userspace

This commit is contained in:
mzz2017
2023-02-18 22:18:34 +08:00
parent 23140c1f15
commit 55c68a1676
3 changed files with 25 additions and 27 deletions

View File

@ -26,6 +26,7 @@ import (
"net/netip"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
@ -322,6 +323,9 @@ func NewControlPlane(
c.dnsUpstream.FinishInitCallback = c.finishInitDnsUpstreamResolve
// Try to invoke once to avoid dns leaking at the very beginning.
_, _ = c.dnsUpstream.GetUpstream()
// Call GC to release memory.
runtime.GC()
return c, nil
}