mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-16 18:46:54 +00:00
MAJOR: stream-interface: dynamically allocate the applet context
From now on, a call to stream_int_register_handler() causes a call to si_alloc_appctx() and returns an initialized appctx for the current stream interface. If one was previously allocated, it is released. If the stream interface was attached to a connection, it is released as well. The appctx are allocated from the same pools as the connections, because they're substantially smaller in size, and we can't have both a connection and an appctx on an interface at any moment. In case of memory shortage, the call may return NULL, which is already handled by all consumers of stream_int_register_handler(). The field appctx was removed from the stream interface since we only rely on the endpoint now. On 32-bit, the stream_interface size went down from 108 to 44 bytes. On 64-bit, it went down from 144 to 64 bytes. This represents a memory saving of 160 bytes per session. It seems that a later improvement could be to move the call to stream_int_register_handler() to session.c for most cases.
This commit is contained in:
parent
1fbe1c9ec8
commit
0a23bcb8be