Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak #1475

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix memory leak #1475

wants to merge 4 commits into from

Conversation

zjd87
Copy link
Contributor

@zjd87 zjd87 commented Jul 8, 2020

No description provided.

zjd87 added 4 commits May 18, 2020 20:01
… too long time and cpu full load, cause health check timeout, 502
…ck block too long time and cpu full load, cause health check timeout, 502"

This reverts commit cafcbaa.
@mrpre
Copy link
Collaborator

mrpre commented Jul 10, 2020

Thanks for report.
c->pool would be destroyed in the end which means there is no memory leaking actually.

@zjd87
Copy link
Contributor Author

zjd87 commented Jul 10, 2020

c->pool = peer->pool. peer->pool is not destroy util nginx stop. Because peer->pool is share memory. So ctx->recv.start is not recycled in time, it maybe occupy memory more and more

@mrpre
Copy link
Collaborator

mrpre commented Jul 10, 2020

I see.
But ngx_pfreewill not free the small block memory in it's pool. ngx_allocand ngx_free should be used for recv.start

@zjd87
Copy link
Contributor Author

zjd87 commented Jul 10, 2020

1、First fix memory leak, ctx->recv.start = ngx_palloc(c->pool, ngx_pagesize / 2) ,So use ngx_pfree recycle to pool
2、Secondly, you can optimize small block memory use
So, I advise fix problem 1 firstly, then solve problem 2 ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants