Skip to content

memory debugging functionality #5

Closed

Description

@AndrewJackson2020

I'm not sure the best way to incorporate this but I think xpg should have memory debugging functionality build in. Thinking stuff like Valgrind, asan/ubsan. asan/ubsan require a custom build whereas valgrind can be attached to any binary. Currently xpg has a postgres build matrix of version (12-19, 8 versions total), and cassert for a total of 16 builds. If we were to add a third matrix dimension for a asan/ubsan build this would explode to 32 builds, not ideal but also not sure how else to handle this. Given this build explosion maybe it would make sense to incorporate valgrind testing first, that said not sure how this would work. Ideally after testing it would exit with return code non 0 if any memory errors were found and thus fail any test, but only for the extension.

Curious what you think.

Activity

  1. AndrewJackson2020 commented on Sep 29, 2026

    @AndrewJackson2020
    ContributorAuthor

    Another issue here is that while valgrind does not require an extra dimension of builds, it only works on linux and not macOS. Not sure exactly how to handle this with nix and if that makes it easer or harder to incorporate here.

  2. steve-chavez commented on Sep 30, 2026

    @steve-chavez
    Member

    I agree in that memory debugging would be useful. I think we could just have the same build for cassert and asan or ubsan. Would there be any downsides to that?

  3. AndrewJackson2020 commented on Sep 30, 2026

    @AndrewJackson2020
    ContributorAuthor

    I think we could just have the same build for cassert and asan or ubsan. Would there be any downsides to that?

    Some stuff I can think of:

    1. I can't think of a downside but pgbouncer (C project that I'm most familiar with) builds with cassert in multiple CI pipelines but only asan/ubsan in one specific pipeline. Maybe this is out of the norm and it is no problem in practice. im just not familiar enough to now.
    2. in addition to the build we need some mechanism for xpg test to detect a memory error and return a non zero error code (I think this should be doable)

    [0] https://github.com/pgbouncer/pgbouncer/blob/7d38761c8f6c757238fde9f942cf9fe0cd272ae3/.github/workflows/pgbouncer-ci.yml#L172

  4. mkaruza commented on Oct 2, 2026

    @mkaruza

    I don't think there is any benefit of running all version with USAN/UBSAN enabled. As @AndrewJackson2020 mentioned it should be enough to run on "default"/some version.

  5. AndrewJackson2020 commented on Nov 3, 2026

    @AndrewJackson2020
    ContributorAuthor

    Closed due to #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions