]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CLEANUP: Add static void hlua_deinit()
authorTim Duesterhus <tim@bastelstu.be>
Sat, 4 Jul 2020 09:53:26 +0000 (11:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Jul 2020 14:52:35 +0000 (16:52 +0200)
commitd0c0ca2720a387fd21006302c441c7add5a25b70
tree0dd91c8b7789d5ba0cef0c2cf79c448d0b3c75d2
parentbbdd5b8ca990de52c14628e58d783435fc8c0452
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
src/hlua.c