diff options
author | Steven Barth <steven@midlink.org> | 2008-06-20 19:57:57 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-20 19:57:57 +0000 |
commit | 65870edf9f1e579b4301e1677d70c9387a9a72dc (patch) | |
tree | ad34a187c824027f8e328bece03c3f67527a89f2 /libs/core/luasrc/util.lua | |
parent | e2e9e119d670ec80954fc8c018b479b218a7e47e (diff) |
* libs/core: Added garbage collector to luci.util.threadlocal to avoid memory leaks
* libs/http: Use env-Variables instead of headers for parse_message_body and subsequent functions
* libs/http: Added missing urldecode call for parsing urlencoded params
* libs/web: Ported luci.http to use ltn12 sources and sinks instead of sockets or file pointers
* libs/sgi-cgi, libs/sgi-webuci, libs/sgi-wsapi: Updated to work with new luci.http.Request ABI
Diffstat (limited to 'libs/core/luasrc/util.lua')
-rw-r--r-- | libs/core/luasrc/util.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 3a0b2fbfc..516856057 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -281,6 +281,13 @@ function threadlocal() rawset(self, thread, {}) end rawget(self, thread)[key] = value + + -- Avoid memory leaks by removing abandoned stores + for k, v in pairs(self) do + if type(k) == "thread" and coroutine.status(k) == "dead" then + rawset(self, k, nil) + end + end end setmetatable(tbl, {__index = get, __newindex = set}) |