Skip to content

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

Description

@fairyqb

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)

`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions