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

lua call memory leak #49

Closed
lparam opened this issue Oct 14, 2013 · 2 comments
Closed

lua call memory leak #49

lparam opened this issue Oct 14, 2013 · 2 comments

Comments

@lparam
Copy link

lparam commented Oct 14, 2013

valgrind log:

==23747== HEAP SUMMARY: [12/59790]
==23747== in use at exit: 2,706,935 bytes in 103 blocks
==23747== total heap usage: 3,314 allocs, 3,211 frees, 6,028,122 bytes allocated
==23747==
==23747== 1 bytes in 1 blocks are definitely lost in loss record 1 of 55
==23747== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23747== by 0x8D6A9F0: ???
==23747== by 0x5469E49: luaD_precall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5475353: luaV_execute (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A098: luaD_call (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5466240: lua_callk (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5480E36: ll_require (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5469E49: luaD_precall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5475353: luaV_execute (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A098: luaD_call (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x54696DA: luaD_rawrunprotected (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A2C4: luaD_pcall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747==
==23747== 264 bytes in 1 blocks are definitely lost in loss record 43 of 55
==23747== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23747== by 0x8D6ADC4: ???
==23747== by 0x8D6976B: ???
==23747== by 0x5469E49: luaD_precall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5475353: luaV_execute (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A098: luaD_call (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x54696DA: luaD_rawrunprotected (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A2C4: luaD_pcall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546630E: lua_pcallk (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x6360850: _init (service_lua.c:165)
==23747== by 0x6360976: _launch (service_lua.c:182)
==23747== by 0x405DE5: skynet_context_message_dispatch (skynet_server.c:259)
==23747==
==23747== 2,097,156 bytes in 1 blocks are definitely lost in loss record 55 of 55
==23747== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23747== by 0x8D6AC29: ???
==23747== by 0x5469E49: luaD_precall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5475353: luaV_execute (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A098: luaD_call (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5466240: lua_callk (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5480E36: ll_require (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5469E49: luaD_precall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x5475353: luaV_execute (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A098: luaD_call (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x54696DA: luaD_rawrunprotected (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747== by 0x546A2C4: luaD_pcall (in /usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0)
==23747==
==23747== LEAK SUMMARY:
==23747== definitely lost: 2,097,421 bytes in 3 blocks
==23747== indirectly lost: 0 bytes in 0 blocks
==23747== possibly lost: 0 bytes in 0 blocks
==23747== still reachable: 609,514 bytes in 100 blocks
==23747== suppressed: 0 bytes in 0 blocks
==23747== Reachable blocks (those to which a pointer was found) are not shown.
==23747== To see them, rerun with: --leak-check=full --show-reachable=yes
==23747==
==23747== For counts of detected and suppressed errors, rerun with: -v
==23747== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 2 from 2)

请问上面3个error有可能是哪里引起的?

@lparam
Copy link
Author

lparam commented Oct 14, 2013

初步判断是由lua-remoteobj.c或lua-seri.c引起的,暂时没发现让valgrind加载skynet.so的方法

@cloudwu
Copy link
Owner

cloudwu commented Oct 14, 2013

只要没有长期工作的持续性分配, 都是忽略的. 有很多地方一次性分配内存都不考虑主动释放问题.

用 lua 协议编码的消息,因为错误导致消息丢失,也是不回收内存的。

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