Skip to content

Plug minimal memleak in keeper's configuration (Last in a series)#583

Merged
DimCitus merged 1 commit intohapostgres:masterfrom
gkokolatos:pg_auto_failover-plug-keeprconfig-leak
Feb 5, 2021
Merged

Plug minimal memleak in keeper's configuration (Last in a series)#583
DimCitus merged 1 commit intohapostgres:masterfrom
gkokolatos:pg_auto_failover-plug-keeprconfig-leak

Conversation

@gkokolatos
Copy link
Copy Markdown
Collaborator

Admittedly this leak could have been plugged with a couple of well placed calls
to the now obsolete keeper_config_destroy() function. However, given the
lifecycle and globality of the struct the variable is found in, ownership is
blurred in some cases.

Instead the leaking variable is now living in the stack along with the rest. A
new variable for its length is added instead of MAXCONNINFO which seems a bit
too excessive. Alignment concerns aside, some relief from the stack stress might
be desirable.

Finally, the necessity for keeper_config_destroy is now removed. Thus the
function itself is removed for the benefit of the reader of the codebase.

Admittedly this leak could have been plugged with a couple of well placed calls
to the now obsolete keeper_config_destroy() function. However, given the
lifecycle and globality of the struct the variable is found, ownership is
blurred in some cases.

Instead the leaking variable is now living in the stack along with the rest. A
new variable for its length is added instead of MAXCONNINFO which seems a bit
too excessive. Alignment concerns aside, some relief from the stack stress might
be desirable.

Finally, the necessity for keeper_config_destroy is now removed. Thus the
function itself is removed for the benefit of the reader of the codebase.
Copy link
Copy Markdown
Collaborator

@DimCitus DimCitus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that clean-up!

@DimCitus DimCitus merged commit e5ba4f0 into hapostgres:master Feb 5, 2021
@DimCitus DimCitus added the bug Something isn't working label Feb 5, 2021
@DimCitus DimCitus added this to the Sprint 2021 W4 W5 milestone Feb 5, 2021
@gkokolatos gkokolatos deleted the pg_auto_failover-plug-keeprconfig-leak branch February 5, 2021 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants