My module has c++ code which instantiates a class. I am driving most of my c++ from one ptr which I am saving in the context.
I tried changing my code to use pool cleanup, it behaving worse than request->cleanup. Of the four requests I send, the cleanup handler is only getting called for two. I did a little more digging into the request->cleanup issue. It looks like, for the case where I thought my cleanup handler wasn't getting called, it was actually getting called. In my handler I was trying to retrieve my module context (ngx_http_get_module_ctx). I could not retrieve the module context in the failure case. I allocated my context from r->connection->pool. I suspect, in the failure case the contexts are getting freed before the clean up callbacks are complete. On Thu, May 18, 2017 at 10:57 AM, Maxim Dounin <mdou...@mdounin.ru> wrote: > Hello! > > On Thu, May 18, 2017 at 10:23:18AM -0700, Dk Jack wrote: > > > I just want to release memory l've allocated. One more question, > > is the context memory automatically removed or is the module > > responsible for freeing it. > > Anything you allocate from request pool (r->pool) using > ngx_p*alloc() functions is automatically freeded when the request > pool is destroyed. If you allocate memory directly from OS, you > are responsible to free it yourself (though this shouldn't happen > except in very special cases). > > -- > Maxim Dounin > http://nginx.org/ > _______________________________________________ > nginx-devel mailing list > nginx-devel@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx-devel >
_______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel