Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Strings in luajit are infinitely bloated, even if they are not rereferenced in the lua vm #242

Open
fairyqb opened this issue Aug 22, 2024 · 0 comments

Comments

@fairyqb
Copy link

fairyqb commented Aug 22, 2024

Strings in luajit are infinitely bloated, even if they are not rereferenced in the lua vm. As a result, the memory resources of the nginx process RES are increasing to become larger and larger.

Minimal example code

resty example.lua

`
local function get_memory_usage()
local b = collectgarbage("count") * 1024
return b
end

local my_table = {}  
for i = 1, 10000000 do  
    my_table[i] =  string.rep("A" , 256) .. i  

end

my_table = nil
print("start gc:", "mem:",get_memory_usage())
collectgarbage("collect") 
print("end gc:", "mem:",get_memory_usage())
print("sleep 10m")

print("done")
ngx.sleep(60*10*6)

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant