Re: Fix some memory leaks in ecpg.addons

From: "Tristan Partin" <tristan(at)neon(dot)tech>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Andres Freund" <andres(at)anarazel(dot)de>, "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix some memory leaks in ecpg.addons
Date: 2023-11-15 10:14:50
Message-ID: CWZB1U4JGPRM.19VFDHZCRL50D@neon.tech
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed Nov 8, 2023 at 11:52 AM CST, Tom Lane wrote:
> "Tristan Partin" <tristan(at)neon(dot)tech> writes:
> > On Wed Nov 8, 2023 at 11:18 AM CST, Michael Meskes wrote:
> >> Agreed, it's not exactly uncommon for tools like ecpg to not worry
> >> about memory. After all it gets freed when the program ends.
>
> > In the default configuration of AddressSanitizer, I can't even complete
> > a full build of Postgres.
>
> Why is the meson stuff building ecpg test cases as part of the core build?
> That seems wrong for a number of reasons, not only that we don't hold
> that code to the same standards as the core server.

After looking into this a tiny bit more, we are building the
dependencies of the ecpg tests.

> foreach pgc_file : pgc_files
> exe_input = custom_target('@0(at)(dot)c'.format(pgc_file),
> input: '@0(at)(dot)pgc'.format(pgc_file),
> output: '@BASENAME(at)(dot)c',
> command: ecpg_preproc_test_command_start +
> ['-C', 'ORACLE',] +
> ecpg_preproc_test_command_end,
> install: false,
> build_by_default: false,
> kwargs: exe_preproc_kw,
> )
>
> ecpg_test_dependencies += executable(pgc_file,
> exe_input,
> kwargs: ecpg_test_exec_kw,
> )
> endforeach

This is the pattern that we have in all the ecpg/test/*/meson.build
files. That ecpg_test_dependencies variable is then used in the actual
ecpg tests:

> tests += {
> 'name': 'ecpg',
> 'sd': meson.current_source_dir(),
> 'bd': meson.current_build_dir(),
> 'ecpg': {
> 'expecteddir': meson.current_source_dir(),
> 'inputdir': meson.current_build_dir(),
> 'schedule': ecpg_test_files,
> 'sql': [
> 'sql/twophase',
> ],
> 'test_kwargs': {
> 'depends': ecpg_test_dependencies,
> },
> 'dbname': 'ecpg1_regression,ecpg2_regression',
> 'regress_args': ecpg_regress_args,
> },
> }

So in my opinion there is nothing wrong here. The build is working as
intended. Does this make sense to you, Tom?

--
Tristan Partin
Neon (https://neon.tech)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-11-15 10:27:13 Re: Remove MSVC scripts from the tree
Previous Message Heikki Linnakangas 2023-11-15 10:11:40 Re: ResourceOwner refactoring