Skip to content

查询时内存不断增长--内存泄露 #6

@spyth

Description

@spyth

Hi,不知道是不是调用的方式不对,查询的时候内存会一直不断增长。

下面是我写的脚本,可以重现。
环境是:CentOS 7.5.1804, openresty/1.13.6.2

-- test.lua
local geoip = require("resty.maxminddb").new("/usr/local/share/GeoIP/GeoLite2-Country.mmdb")
for i = 1, 200000 do
  local ip = string.format("%s.%s.%s.%s", math.random(1, 255), math.random(1, 255), math.random(1, 255), math.random(1, 255))
  local res, err = geoip:lookup(ip)
  if res and res.country and res.country.iso_code then
    print(i, res.country.iso_code)
  end
end

$ resty test.lua

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions