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

closed #99

Closed
SeniorPlayer opened this issue Feb 23, 2019 · 0 comments
Closed

closed #99

SeniorPlayer opened this issue Feb 23, 2019 · 0 comments

Comments

@SeniorPlayer
Copy link

lua code:

function Sleep(n)
   os.execute("sleep " .. n)
end
function Test()
    local a = {}
    for i=1, 10000 do
        local b = {}
        for j=1, 10000 do
            b[j] = j
        end
        a[i]= b
    end
    Sleep(5)
    print(#a)
end
Test()
Sleep(2)
collectgarbage("collect")
Sleep(1200)
print("sleep end")

compare memory usage of glua and lua5.1
glua test.lua
glua 0.0 00:21.51 12 0 21 4857M

glua's memory usage is always 4857M

lua5.1 test.lua
lua-5.1 0.0 00:03.53 1 0 10 2504M
lua-5.1 0.0 00:03.70 1 0 10 7408K

lua5.1's memory usage from 2504M down to 7408K

The local variables's memory should released by gc after the function return.

@SeniorPlayer SeniorPlayer changed the title local variables's memory is not released by gc closed Feb 23, 2019
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