Re: Avoid memory leaks during base backups
От | Bharath Rupireddy |
---|---|
Тема | Re: Avoid memory leaks during base backups |
Дата | |
Msg-id | CALj2ACVGKCLyWSiXsZKV1UcoMyfXEBv48QGJ0ogF1LZH97fj8A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Avoid memory leaks during base backups (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Avoid memory leaks during base backups
|
Список | pgsql-hackers |
On Mon, Sep 26, 2022 at 7:34 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > > I'm proposing a patch that leverages the error callback mechanism and > > memory context. > > This ... seems like inventing your own shape of wheel. The > normal mechanism for preventing this type of leak is to put the > allocations in a memory context that can be reset or deallocated > in mainline code at the end of the operation. Yes, that's the typical way and the patch attached does it for perform_base_backup(). What happens if we allocate some memory in the new memory context and error-out before reaching the end of operation? How do we deallocate such memory? Backup related code has simple-to-generate-error paths in between and memory can easily be leaked. Are you suggesting to use sigsetjmp or some other way to prevent memory leaks? > I do not think that > having an errcontext callback with side-effects like deallocating > memory is even remotely safe, and it's certainly a first-order > abuse of that mechanism. Are you saying that the error callback might deallocate the memory that may be needed later in the error processing? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
В списке pgsql-hackers по дате отправления: