IP库增加释放方法

This commit is contained in:
GoEdgeLab
2023-03-31 12:40:13 +08:00
parent ec9e585b5e
commit 7cd3a9f901
2 changed files with 13 additions and 0 deletions

View File

@@ -115,3 +115,9 @@ func (this *IPLibrary) LookupIP(ip string) *QueryResult {
}
return this.Lookup(net.ParseIP(ip))
}
func (this *IPLibrary) Destroy() {
if this.reader != nil {
this.reader.Destroy()
}
}

View File

@@ -170,6 +170,13 @@ func (this *Reader) IPv6Items() []*ipv6Item {
return this.ipV6Items
}
func (this *Reader) Destroy() {
this.meta = nil
this.regionMap = nil
this.ipV4Items = nil
this.ipV6Items = nil
}
// 分析数据
func (this *Reader) parse(data []byte) (left []byte, err error) {
if len(data) == 0 {