lua collectgarbage 主动控制垃圾回收的频率

https://www.cnblogs.com/hujingnb/p/12685291.html   

http://cloudwu.github.io/lua53doc/manual.html#2.5

https://zhuanlan.zhihu.com/p/137766974

  1. collectgarbage("setpause", 200)

--- **"setpause"**: sets `arg` as the new value for the *pause* of the collector

--- (see §2.5). Returns the previous value for *pause`.

在开启下一轮GC扫描标记前需要暂停多久, 200代表总内存使用量达到 之前的两倍时才开始新的循环。

  1. collectgarbage("setstepmul", 1500)

控制扫描速率。当前扫描验证速率是内存增长率的15倍。

  1. collectgarbage("step", 1024)

    主动让GC器去扫描1M数据.

改变自己
原文地址:https://www.cnblogs.com/sun-shadow/p/15191331.html