Skip to content

Valgrind CI check #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Valgrind CI check #909

wants to merge 14 commits into from

Conversation

schnellerhase
Copy link
Contributor

@schnellerhase schnellerhase commented Mar 21, 2025

Adds a valgrind check to the CI.

First step to resolve FEniCS/dolfinx#1355

There are two main options to execute valgrind in a Python context

  1. use a standard Python executable and overwrite PYTHONMALLOC=malloc to allow for valgrind to properly track allocations (the approach used in the pybind11 PR linked by the issue), or
  2. configure (and build) Python with flag --with-valgrind.

Option 1 is very easy to setup (no custom Python install necessary) however the runtime gets out of hand and does not allow to reasonably check all test cases. Option 2 is the one chosen here and allows to execute all tests in a reasonable execution time.

Performance is still far from great, possibly a large speed up can be gained if the test cases are further split up into batches. In the current setup the whole pytest test/ run is a single valgrind call - this collects overhead during execution.

Note: Python is configured without -enable-optimizations --with-lto as recommended - while setting the optimization flags reduces the test execution runtime drastically the additional compile time of Python is not worth the gain here.

Note: Leak kind choice of definite,indirect is not driven by any observation, can be configured further as seen fit.

@schnellerhase schnellerhase force-pushed the valgrind branch 2 times, most recently from 036e176 to 98d2965 Compare March 23, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add memory checks to CI (valgrind)
1 participant