Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectCache.push 修改后,导致unity一直报告内存分配错误 #179

Closed
jianwang119 opened this issue Apr 13, 2017 · 2 comments
Closed

Comments

@jianwang119
Copy link

jianwang119 commented Apr 13, 2017

internal void push(IntPtr l, object o, bool checkReflect)
{
	......
        int index = -1;

        bool gco = isGcObject(o);
        bool found = gco && objMap.TryGetValue(o, out index);
        if (found)
        {
              if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1)
                    return; // 原始版本在此处会退出
         }
	......
}

internal int allocID(IntPtr l,object o) {
       int index = -1;
	......
	if (found)
	{
		if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1)
			return index; // 修改版本在此处会返回有效的index
	}
	......
}
internal void push(IntPtr l, object o, bool checkReflect)
{
	int index = allocID (l, o);
	if (index < 0)   // 修改版本在找到的情况下和老版本行为不一致
		return;
	......
}

更新最新版本后,部分情况下unity会报告错误
Allocation of 19320 bytes at 059eb510
TLS Allocator ALLOC_TEMP_THREAD, underlying allocator ALLOC_TEMP_THREAD has unfreed allocations

internal int allocID(IntPtr l,object o) {
       int index = -1;
	......
	if (found)
	{
		if (LuaDLL.luaS_getcacheud(l, index, udCacheRef) == 1)
			return -1; // 改为-1后,情况正常
	}
	......
}
@pangweiwei
Copy link
Owner

感谢反馈bug

@pangweiwei
Copy link
Owner

已经fix了,再次感谢提交错误。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants