GUI / nginx-upstream-dynamic-servers

An nginx module to resolve domain names inside upstreams and keep them up to date.
MIT License
312 stars 74 forks source link

slove memory leak when domain name changes very frequently #39

Open Sunldon opened 5 months ago

Sunldon commented 5 months ago
  1. When using (ngx_parse_url(ngx_cycle->pool, &u) != NGX_OK) to parse URLs, if the domain name changes very frequently, the memory occupied by ngx_cycle->pool will increase continually. This memory is only released when Nginx is reloaded. Creating a new memory pool can solve this issue.
  2. There is a memory leak in dynamic_server[i].previous_pool which needs to be checked if it is null. During the first assignment, dynamic_server->previous_pool = dynamic_server->pool, dynamic_server->pool is null. In the second assignment, it is assigned a new value (new_pool), hence the memory allocated for the previous new_pool is not released.
Sunldon commented 5 months ago

38

this patch have resolved that problem