Re: Fix memory leak when output postgres_fdw's "Relations"

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix memory leak when output postgres_fdw's "Relations"
Date: 2021-07-23 19:20:37
Message-ID: CAEudQArMHGG4vbkSzCnXRETFfcAH-J_uVMZwep=qjVufaPVjcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sex., 23 de jul. de 2021 às 11:32, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> escreveu:

> Ranier Vilela <ranier(dot)vf(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-07-23 19:57:41 Re: Configure with thread sanitizer fails the thread test
Previous Message Tom Lane 2021-07-23 18:07:32 Re: Followup Timestamp to timestamp with TZ conversion