[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Userdata environment
- From: Shmuel Zeigerman <shmuz@...>
- Date: Tue, 01 Apr 2008 11:59:47 +0200
Alex Davies wrote:
I'm afraid I still can't imagine a scenario where that's possible. I
mean, it doesn't keep dead keys around forever. Just until it needs to
grow the table, and then it can remove them all.. and in doing so
discover that it never needed to grow the table in the first place. The
only way it could consume all available memory would be if at some point
you had enough live keys in the table to do that.
Here is a pure-Lua test case that is very close to what my application
is doing. (Change N if needed).
local N = 6
local tb = setmetatable ({}, { __mode="k" })
print(collectgarbage"count")
for n=1,N do
for k=1,1e6 do tb[{}] = true end
print(collectgarbage"count")
end
--
Shmuel