Commit 8c154e114068df7f135b18ba49f74058ed38ce63

Authored by saicom
1 parent e3f6fe34

定时gc

Showing 2 changed files with 8 additions and 1 deletions   Show diff stats
src/agent.lua
... ... @@ -35,10 +35,17 @@ local function handle_timeout()
35 35 skynet.timeout(100, handle_timeout)
36 36 end
37 37  
  38 +local function handle_gc()
  39 + if agentInfo.open_timer then return end
  40 + collectgarbage("collect")
  41 + skynet.timeout(6000, handle_gc)
  42 +end
  43 +
38 44 function start_agent_timer()
39 45 if agentInfo.open_timer then return end
40 46 agentInfo.open_timer = true
41 47 skynet.timeout(150, handle_timeout)
  48 + skynet.timeout(6000, handle_gc)
42 49 end
43 50  
44 51 function cancel_agent_timer()
... ...
1   -Subproject commit a77261549372a508e132953dacc6398ba793dcc1
  1 +Subproject commit e2c89ce97a826a716af84cb15d2976d3f19dcd1c
... ...