uiuizz
uiuizz
https://github.com/cloudfreexiao/lua-protobuf/tree/pr @cloudfreexiao @hanxi 你好,这个分支,skynet 多个服务同时使用是安全的吗,现在我们每个服务都去加载protobuf的pb文件,导致cmem会占1.7M。我刚刚试了下这个可以用,如果是安全的,会给我们节省很多内存。如果可以用,那效率不知道和不共享lua state,会不会有差别
@starwing 程序启动时 local protobuf = require "pb" protobuf.loadfile() ,加载了一批pb文件 然后调用 local protobuf_unsafe = require "pb.unsafe" protobuf_unsafe.use("global") 后面的新建服务使用 local protobuf = require "pb" protobuf.decode和protobuf.encode 这样报|exceptionUtil.lua:33:unknown| bad argument #1 to 'pb.decode' (type...
@starwing 嗯,现在可以了。查了下 共享时 const pb_State *state; 这个只在加载时赋值,后续不会修改,其他好像都是每个状态机自己的,按理是没有多线程问题