mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
make coroutine_pool weak would be better
This commit is contained in:
@@ -95,7 +95,7 @@ end
|
|||||||
|
|
||||||
-- coroutine reuse
|
-- coroutine reuse
|
||||||
|
|
||||||
local coroutine_pool = {}
|
local coroutine_pool = setmetatable({}, { __mode = "kv" })
|
||||||
|
|
||||||
local function co_create(f)
|
local function co_create(f)
|
||||||
local co = table.remove(coroutine_pool)
|
local co = table.remove(coroutine_pool)
|
||||||
@@ -661,15 +661,10 @@ function skynet.memlimit(bytes)
|
|||||||
skynet.memlimit = nil -- set only once
|
skynet.memlimit = nil -- set only once
|
||||||
end
|
end
|
||||||
|
|
||||||
local function clear_pool()
|
|
||||||
coroutine_pool = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Inject internal debug framework
|
-- Inject internal debug framework
|
||||||
local debug = require "skynet.debug"
|
local debug = require "skynet.debug"
|
||||||
debug(skynet, {
|
debug(skynet, {
|
||||||
dispatch = skynet.dispatch_message,
|
dispatch = skynet.dispatch_message,
|
||||||
clear = clear_pool,
|
|
||||||
suspend = suspend,
|
suspend = suspend,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ function dbgcmd.MEM()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function dbgcmd.GC()
|
function dbgcmd.GC()
|
||||||
export.clear()
|
|
||||||
collectgarbage "collect"
|
collectgarbage "collect"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user