Closed jayce closed 1 year ago
I also found this problem, how to solve it?
Honestly, I don’t know how to reproduce it or debug it. I doubt that any Lua code is leaking, although if it only happens with Lua 5.1 and a modern Lua that is a possibility. Or maybe lyaml is leaking? Or it must be the C code here in lyaml.
If you can describe a reliable way to reproduce the leak I’ll at least have somewhere to start. If you want to investigate and propose a fix, that would definitely be the fastest way to remedy the problem.
The code is as follows:
local yaml=require("lyaml")
print(collectgarbage("count"),"kb")
for i=1,10000 do
yaml.dump({{a="b"}})
end
print(collectgarbage("count"),"kb")
collectgarbage()
print(collectgarbage("count"),"kb")
The printing results are as follows: 104.9541015625 kb 8414.7314453125 kb 5820.7744140625 kb
About 5M of memory is not recycled
Hi, I found a problem, looks like memory leak, in lua-5.1.4. see the following image and code.
screenshot:
the code:
and the mem of flamegraph, maybe the problem is
Pemitter()
oremit()
: