releasing memory.
Dk Jack
dnj0496 at gmail.com
Thu May 18 22:06:32 UTC 2017
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 <mdounin at 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 at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20170518/cc9693d3/attachment-0001.html>
More information about the nginx-devel
mailing list