releasing memory.

Dk Jack dnj0496 at
Thu May 18 00:53:40 UTC 2017

In my module, I registered a NGX_HTTP_POST_READ_PHASE handler. When this
handler is invoked, I allocate my module context and attach it to the
request. I also allocate some other memory and save the pointers to that
memory in my context. In the POST_READ_PHASE handler, I also register a
cleanup handler to the request (r->cleanup; ngx_http_cleanup_t
<>). I assumed this is
called before the request is freed.

As I expected, my cleanup handler is getting called for most of the
requests. However, in some cases it doesn't get called. This seems to
happen mostly for the first request and if and only if the request is a
very simple url like 'http://servername/' i.e. a simple request which tests
server is up and running or not. If I add anything more to the uri-path,
the cleanup handler gets called. Otherwise, it doesn't get called. Seems
very strange. Could someone more knowledgeable comment on this behavior.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list