yaukeywang / luamemorysnapshotdump Goto Github PK
View Code? Open in Web Editor NEWLua memory snapshot dump utility, used for memory leak detection。
License: MIT License
Lua memory snapshot dump utility, used for memory leak detection。
License: MIT License
为查内存泄漏,我在一个使用OpenResty的项目中应用了您的开源组件,不过在对比两个生成的文件时报错,提示如下
(3) [globbing] error: bad range specification after pos 61
有什么方法可以找出原因吗,或者正确的两个文件名写法是什么?
LuaMemRefInfos.zip
类似这种:
table: 0x852eaac0 registry.5.[table:key.table] 4
table: 0xfce05b40 registry.5.[table:key.table] 4
table: 0xc10a44a8 registry.5.[table:key.table] 4
table: 0xbe43e9d8 registry.5.[table:key.table] 4
table: 0x012b9dd9c8 registry.5.[table:key.table] 4
table: 0x012bf14b48 registry.5.[table:key.table] 4
table: 0xf5027880 registry.5.[table:key.table] 4
table: 0x012da66518 registry.5.[table:key.table] 4
table: 0x011437a3d8 registry.5.[table:key.table] 4
table: 0xbe53fc10 registry.5.[table:key.table] 4
我觉的现在类似深搜的这种搜索出来的路径,很难分析 应该按照广搜 或者优先搜索thread与function之外的对象,之后再搜thread和function及只有他们引用的upvalues,这样引用路径会清爽很多而便于分析,我的代码改的比较粗暴只在这里说一下思路代码就不上传了
类似这种:
table: 0x852eaac0 registry.5.[table:key.table] 4
table: 0xfce05b40 registry.5.[table:key.table] 4
table: 0xc10a44a8 registry.5.[table:key.table] 4
table: 0xbe43e9d8 registry.5.[table:key.table] 4
table: 0x012b9dd9c8 registry.5.[table:key.table] 4
table: 0x012bf14b48 registry.5.[table:key.table] 4
table: 0xf5027880 registry.5.[table:key.table] 4
table: 0x012da66518 registry.5.[table:key.table] 4
table: 0x011437a3d8 registry.5.[table:key.table] 4
table: 0xbe53fc10 registry.5.[table:key.table] 4
你好,首先谢谢你的工具。我用该工具获取内存快照后,发现引用对象的前半部分路径并不准确,有时候会指向一个并不存在的变量。但是可以从每个引用对象的后半部分路径推测。lua版本是5.1
Hello,
While trying to use your tool, I was getting the following error:
MemoryReferenceInfo.lua:261: attempt to concatenate 'string' and 'struct 178 *'
and sometimes
MemoryReferenceInfo.lua:261: attempt to concatenate 'string' and 'void *'
I fixed it by changing this line #261 from:
CollectObjectReferenceInMemory(strName .. "." .. k, v, cDumpInfoContainer)
to
CollectObjectReferenceInMemory(strName .. "." .. type(k), v, cDumpInfoContainer)
不好意思,内网无法截图,我只能手写了。以下是我的调用
local mri=require 'common.utils.MemoryReferenceInfo'
if Input.GetKeyDown(KeyCode.U) then
collectiigarbage("collect")
mri.m_cMethods.DumpMemorySnapshot("./","1-Before",10)
elseif Input.GetKeyDown(KeyCode.I) then
collectiigarbage("collect")
mri.m_cMethods.DumpMemorySnapshot("./","2-After,10)
elseif Input.GetKeyDown(KeyCode.O) then
mri.m_cMethods.DumpMemorySnapshotCompareFile("./","Compared",10,"./LuaMemRefInfo-All-[1-Before].txt","./LuaMemRefInfo-All-[2-After].txt"
end
我用的是Slua,对应lua版本5.1,手写输入难免不,但大致是这么写的,我是完全参考你的事例程序这么用的。只要一按U键,立刻屏幕,所有操作都会卡死,也不生成文件(其实到现在我都不知道文件会生成在什么地方)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.