pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18770: The function 'packGraph ' causes a memory leak.
2+ messages / 2 participants
[nested] [flat]
* BUG #18770: The function 'packGraph ' causes a memory leak.
@ 2025-01-10 01:49 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2025-01-10 01:49 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: 2365868844@qq.com
The following bug has been logged on the website:
Bug reference: 18770
Logged by: fengyao
Email address: 2365868844@qq.com
PostgreSQL version: 17.2
Operating system: linux
Description:
Hello,
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.
Have a good day!
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18770: The function 'packGraph ' causes a memory leak.
@ 2025-01-10 14:48 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2025-01-10 14:48 UTC (permalink / raw)
To: 2365868844@qq.com; +Cc: pgsql-bugs@lists.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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-01-10 14:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 01:49 BUG #18770: The function 'packGraph ' causes a memory leak. PG Bug reporting form <noreply@postgresql.org>
2025-01-10 14:48 ` Tom Lane <tgl@sss.pgh.pa.us>
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