IP库增加释放方法

This commit is contained in:
刘祥超
2023-03-31 12:40:13 +08:00
parent 917f8d76a1
commit 226e91a106
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 {