From b8bb327f98e6d86ddffc5685b6a985f66bec8648 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 6 Jun 2016 16:21:59 +0800 Subject: [PATCH] make coroutine_pool weak would be better --- lualib/skynet.lua | 7 +------ lualib/skynet/debug.lua | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index 08a3fa13..abb568c8 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -95,7 +95,7 @@ end -- coroutine reuse -local coroutine_pool = {} +local coroutine_pool = setmetatable({}, { __mode = "kv" }) local function co_create(f) local co = table.remove(coroutine_pool) @@ -661,15 +661,10 @@ function skynet.memlimit(bytes) skynet.memlimit = nil -- set only once end -local function clear_pool() - coroutine_pool = {} -end - -- Inject internal debug framework local debug = require "skynet.debug" debug(skynet, { dispatch = skynet.dispatch_message, - clear = clear_pool, suspend = suspend, }) diff --git a/lualib/skynet/debug.lua b/lualib/skynet/debug.lua index 3d6ff33c..957a2588 100644 --- a/lualib/skynet/debug.lua +++ b/lualib/skynet/debug.lua @@ -20,7 +20,6 @@ function dbgcmd.MEM() end function dbgcmd.GC() - export.clear() collectgarbage "collect" end