pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 2365868844@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18770: The function 'packGraph ' causes a memory leak.
Date: Fri, 10 Jan 2025 09:48:16 -0500
Message-ID: <2421469.1736520496@sss.pgh.pa.us> (raw)
In-Reply-To: <18770-895a62c1890d7491@postgresql.org>
References: <18770-895a62c1890d7491@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> In line 1965 of the trgm_regexp.c file
> 1965:	arcs = (TrgmPackArcInfo *)
> 1966:		palloc(sizeof(TrgmPackArcInfo) * trgmNFA->arcsCount);
> The memory requested 'arcs' was not freed.

This is not a bug, unless you can show that the memory is allocated
in a long-lived context that won't get freed reasonably soon.  We
generally assume that letting memory context cleanup recover memory
is both faster and more oversight-proof than retail pfree calls.

In this particular case, it looks to me like the memory will come from
the temp context made by createTrgmNFA, and therefore will be freed
before that returns.

			regards, tom lane





view thread (2+ messages)

Message-ID: <2421469.1736520496@sss.pgh.pa.us>
Permalink:  ../2421469.1736520496@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2421469.1736520496@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, 2365868844@qq.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18770: The function 'packGraph ' causes a memory leak.
  In-Reply-To: <2421469.1736520496@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox