]> git.kaiwu.me - njs.git/commit
Fetch: free QuickJS response body chain after reading
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 30 Oct 2026 03:16:10 +0000 (20:16 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 2 Nov 2026 14:42:35 +0000 (06:42 -0800)
commitf7d70ccdaafcdb35c3ff6cfa3e2587955b54d12e
treef63728e49e7d77dadc3e96b2648662c8126791a0
parentcb97e2602f7f3b38b2c54d13c25d400dd5fc08bf
Fetch: free QuickJS response body chain after reading

Previously, Response.text(), json() and arrayBuffer() joined the body
chain into a new block of the engine pool and left both the chain
nodes and the joined copy in the pool.  The memory was released only
with the engine, so with js_context_reuse every response body read
accumulated in the pool, unaccounted by the context reuse memory
check.

Now, the chain is destroyed after the body is read.  For text() the
string is created with qjs_string_create_chb(), and for json() the
joined copy is freed after parsing.

The issue was introduced in b7f76b71 (0.9.1).
nginx/ngx_qjs_fetch.c