diff --git a/app/dns/server.go b/app/dns/server.go index 5fbec9b91..dbe879baf 100644 --- a/app/dns/server.go +++ b/app/dns/server.go @@ -105,6 +105,10 @@ func (s *Server) cleanup() { delete(s.records, d) } } + + if len(s.records) == 0 { + s.records = make(map[string]*DomainRecord) + } } func (s *Server) LookupIP(domain string) ([]net.IP, error) { diff --git a/app/proxyman/mux/session.go b/app/proxyman/mux/session.go index c828d21c8..d42814c97 100644 --- a/app/proxyman/mux/session.go +++ b/app/proxyman/mux/session.go @@ -73,6 +73,10 @@ func (m *SessionManager) Remove(id uint16) { } delete(m.sessions, id) + + if len(m.sessions) == 0 { + m.sessions = make(map[uint16]*Session, 16) + } } func (m *SessionManager) Get(id uint16) (*Session, bool) { diff --git a/proxy/vmess/encoding/server.go b/proxy/vmess/encoding/server.go index d3f713c34..19ea32eb6 100644 --- a/proxy/vmess/encoding/server.go +++ b/proxy/vmess/encoding/server.go @@ -78,6 +78,10 @@ func (h *SessionHistory) removeExpiredEntries() { delete(h.cache, session) } } + + if len(h.cache) == 0 { + h.cache = make(map[sessionId]time.Time, 128) + } } type ServerSession struct {