bug: Strings in luajit are infinitely bloated, even if they are not rereferenced in the lua vm
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.4k
- Forks
- 252
- Avg merge
- 7d 11h
- Merged PRs (30d)
- 3
Description
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)
`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal resty example.lua and compare collectgarbage("count") before and after the full collection. Investigate how the reported strings affect the nginx process RES after the Lua VM no longer references them. Done means the reported memory growth is explained and the underlying retention behavior is corrected or documented with a reproducible check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, nginx
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100