]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: lua: forces a garbage collection
authorThierry FOURNIER <tfournier@arpalert.org>
Wed, 23 Sep 2015 14:59:28 +0000 (16:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 27 Sep 2015 09:03:08 +0000 (11:03 +0200)
commit5a50a85f4f17a5928a5c6f635c37a09b3a0d1d07
tree659f8645fce89ec593a2ce2fff77e85dc88bd3a6
parent3adac088492a7e4c837a2bd2e35bf0e15b1e4027
BUG/MEDIUM: lua: forces a garbage collection

When a thread stops this patch forces a garbage collection which
cleanup and free the memory.

The HAProxy Lua Socket class contains an HAProxy session, so it
uses a big amount of memory, in other this Socket class uses a
filedescriptor and maintain a connection open.

If the class Socket is stored in a global variable, the Socket stay
alive along of the life of the process (except if it is closed by the
other size, or if a timeout is reached). If the class Socket is stored
in a local variable, it must die with this variable.

The socket is closed by a call from the garbage collector. And the
portability and use of a variable is known by the same garbage collector.

so, running the GC just after the end of all Lua code ensure that the
heavy resources like the socket class are freed quickly.
src/hlua.c