mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-20 00:10:41 -05:00
CLEANUP: Add static void hlua_deinit()
Compiling HAProxy with USE_LUA=1 and running a configuration check within
valgrind with a very simple configuration such as:
listen foo
bind *:8080
Will report quite a few possible leaks afterwards:
==24048== LEAK SUMMARY:
==24048== definitely lost: 0 bytes in 0 blocks
==24048== indirectly lost: 0 bytes in 0 blocks
==24048== possibly lost: 95,513 bytes in 1,209 blocks
==24048== still reachable: 329,960 bytes in 71 blocks
==24048== suppressed: 0 bytes in 0 blocks
Printing these possible leaks shows that all of them are caused by Lua.
Luckily Lua makes it *very* easy to free all used memory, so let's do
this on shutdown.
Afterwards this patch is applied the output looks much better:
==24199== LEAK SUMMARY:
==24199== definitely lost: 0 bytes in 0 blocks
==24199== indirectly lost: 0 bytes in 0 blocks
==24199== possibly lost: 0 bytes in 0 blocks
==24199== still reachable: 329,960 bytes in 71 blocks
==24199== suppressed: 0 bytes in 0 blocks
This commit is contained in:
parent
bbdd5b8ca9
commit
d0c0ca2720
1 changed files with 7 additions and 0 deletions
|
|
@ -8617,6 +8617,13 @@ void hlua_init(void)
|
|||
RESET_SAFE_LJMP(gL.T);
|
||||
}
|
||||
|
||||
static void hlua_deinit()
|
||||
{
|
||||
lua_close(gL.T);
|
||||
}
|
||||
|
||||
REGISTER_POST_DEINIT(hlua_deinit);
|
||||
|
||||
static void hlua_register_build_options(void)
|
||||
{
|
||||
char *ptr = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue