bugfix issue #494

This commit is contained in:
Cloud Wu
2016-05-11 22:02:10 +08:00
parent e9f397945d
commit 5be836527c
2 changed files with 13 additions and 6 deletions

View File

@@ -492,15 +492,19 @@ static int marksharedproto (global_State *g, SharedProto *f) {
** NULL, so the use of 'markobjectN') ** NULL, so the use of 'markobjectN')
*/ */
static int traverseproto (global_State *g, Proto *f) { static int traverseproto (global_State *g, Proto *f) {
int i; int i,nk,np;
if (f->cache && iswhite(f->cache)) if (f->cache && iswhite(f->cache))
f->cache = NULL; /* allow cache to be collected */ f->cache = NULL; /* allow cache to be collected */
for (i = 0; i < f->sp->sizek; i++) /* mark literals */ if (f->sp == NULL)
return sizeof(Proto);
nk = (f->k == NULL) ? 0 : f->sp->sizek;
np = (f->p == NULL) ? 0 : f->sp->sizep;
for (i = 0; i < nk; i++) /* mark literals */
markvalue(g, &f->k[i]); markvalue(g, &f->k[i]);
for (i = 0; i < f->sp->sizep; i++) /* mark nested protos */ for (i = 0; i < np; i++) /* mark nested protos */
markobjectN(g, f->p[i]); markobjectN(g, f->p[i]);
return sizeof(Proto) + sizeof(Proto *) * f->sp->sizep + return sizeof(Proto) + sizeof(Proto *) * np +
sizeof(TValue) * f->sp->sizek + sizeof(TValue) * nk +
marksharedproto(g, f->sp); marksharedproto(g, f->sp);
} }

View File

@@ -16,7 +16,10 @@ skynet.start(function()
end) end)
local libs = {} local libs = {}
for k,v in ipairs(names) do for k,v in ipairs(names) do
libs[v] = require(v) local ok, m = pcall(require, v)
if ok then
libs[v] = m
end
end end
skynet.error(limit, err) skynet.error(limit, err)
skynet.exit() skynet.exit()