Re: Fix memory leak when output postgres_fdw's "Relations" - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Fix memory leak when output postgres_fdw's "Relations"
Date
Msg-id CAEudQArMHGG4vbkSzCnXRETFfcAH-J_uVMZwep=qjVufaPVjcg@mail.gmail.com
Whole thread Raw
In response to Re: Fix memory leak when output postgres_fdw's "Relations"  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fix memory leak when output postgres_fdw's "Relations"  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Em sex., 23 de jul. de 2021 às 11:32, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
Ranier Vilela <ranier.vf@gmail.com> writes:
> This is a minor leak, oversight in
> https://github.com/postgres/postgres/commit/4526951d564a7eed512b4a0ac3b5893e0a115690#diff-e399f5c029192320f310a79f18c20fb18c8e916fee993237f6f82f05dad851c5

I don't think you understand how Postgres memory management works.
Maybe not yet. Valgrind may also don't understand yet.
 
There's no permanent leak here, just till the end of the command;
so it's pretty doubtful that there's any need to expend cycles on
an explicit pfree.
Maybe.

==30691== 24 bytes in 1 blocks are definitely lost in loss record 123 of 469
==30691==    at 0x8991F0: MemoryContextAlloc (mcxt.c:893)
==30691==    by 0x899F29: MemoryContextStrdup (mcxt.c:1291)
==30691==    by 0x864E09: RelationInitIndexAccessInfo (relcache.c:1419)
==30691==    by 0x865F81: RelationBuildDesc (relcache.c:1175)
==30691==    by 0x868575: load_critical_index (relcache.c:4168)
==30691==    by 0x8684A0: RelationCacheInitializePhase3 (relcache.c:3980)
==30691==    by 0x88047A: InitPostgres (postinit.c:1031)
==30691==    by 0x773F12: PostgresMain (postgres.c:4081)
==30691==    by 0x6F9C33: BackendRun (postmaster.c:4506)
==30691==    by 0x6F96D8: BackendStartup (postmaster.c:4228)
==30691==    by 0x6F8C08: ServerLoop (postmaster.c:1745)
==30691==    by 0x6F747B: PostmasterMain (postmaster.c:1417)
 
Is this is a false-positive?

regards,
Ranier Vilela

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Followup Timestamp to timestamp with TZ conversion
Next
From: Robert Haas
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY