On 04/15/2015 04:11 AM, GHui wrote:
I use apr_socket_create in a short connect.
And it takes up more and more memory as the program runs.
Any help will be appreciated.
--GHui
The normal way to handle that is to create a pool for data that must be
maintained only for the life of that connection. When the connection is
over, clear the pool (apr_pool_clear) to make the memory available for
reuse so that the process doesn't have to allocate more and more for the
connection processing.
apr_pool_create(&foo, ...)
while (1) {
apr_pool_clear(foo)
apr_socket_create(foo, ...)
....
apr_socket_close(...)
}