Fixing shared app queue unmap size.
Shared app queue takes more memory than port memory. To unmap all memory pages correct size need to be specified for munmap() call. Otherwise 4 Mb memory leaked on each configured application removal. The issue was introduced in 1d84b9e4b459.
This commit is contained in:
@@ -104,6 +104,13 @@ that uses WebSocket.
|
|||||||
</para>
|
</para>
|
||||||
</change>
|
</change>
|
||||||
|
|
||||||
|
<change type="bugfix">
|
||||||
|
<para>
|
||||||
|
a memory leak occurring in the router process when removing or reconfiguring
|
||||||
|
an application; the bug had appeared in 1.19.0.
|
||||||
|
</para>
|
||||||
|
</change>
|
||||||
|
|
||||||
</changes>
|
</changes>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <nxt_runtime.h>
|
#include <nxt_runtime.h>
|
||||||
#include <nxt_port.h>
|
#include <nxt_port.h>
|
||||||
#include <nxt_router.h>
|
#include <nxt_router.h>
|
||||||
|
#include <nxt_app_queue.h>
|
||||||
#include <nxt_port_queue.h>
|
#include <nxt_port_queue.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -84,6 +85,8 @@ nxt_port_new(nxt_task_t *task, nxt_port_id_t id, nxt_pid_t pid,
|
|||||||
void
|
void
|
||||||
nxt_port_close(nxt_task_t *task, nxt_port_t *port)
|
nxt_port_close(nxt_task_t *task, nxt_port_t *port)
|
||||||
{
|
{
|
||||||
|
size_t size;
|
||||||
|
|
||||||
nxt_debug(task, "port %p %d:%d close, type %d", port, port->pid,
|
nxt_debug(task, "port %p %d:%d close, type %d", port, port->pid,
|
||||||
port->id, port->type);
|
port->id, port->type);
|
||||||
|
|
||||||
@@ -109,7 +112,10 @@ nxt_port_close(nxt_task_t *task, nxt_port_t *port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (port->queue != NULL) {
|
if (port->queue != NULL) {
|
||||||
nxt_mem_munmap(port->queue, sizeof(nxt_port_queue_t));
|
size = (port->id == (nxt_port_id_t) -1) ? sizeof(nxt_app_queue_t)
|
||||||
|
: sizeof(nxt_port_queue_t);
|
||||||
|
nxt_mem_munmap(port->queue, size);
|
||||||
|
|
||||||
port->queue = NULL;
|
port->queue = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user