Re: BUG #18770: The function 'packGraph ' causes a memory leak.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 2365868844(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18770: The function 'packGraph ' causes a memory leak.
Date: 2025-01-10 14:48:16
Message-ID: 2421469.1736520496@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message yuansong 2025-01-11 09:40:01 Re:Re: Re:Re:Re: backup server core when redo btree_xlog_insert that type is XLOG_BTREE_INSERT_POST
Previous Message Asphator 2025-01-10 11:54:20 Re: BUG #18663: synchronous_standby_names vs synchronous_commit vs pg_stat_replication