Skip to content

gitlab-ci: Use MALLOC_CHECK_ and MALLOC_PERTURB_ env variables in tests

Marco Trevisan requested to merge 3v1n0/mutter:malloc-check-ci into master

Linux glibc supports a malloc implementation that is allows to be tunable using environment variables, to check allocation issues.

When MALLOC_CHECK_ is set to 3, a diagnostic message is printed on stderr and the program is aborted.

Setting the MALLOC_PERTURB_ environment variable causes the malloc functions in to return memory which has been wiped and initialized with the byte value of the environment variable.

So use this features when running tests in order to catch better memory errors.

!578 (merged)


MALLOC_PERTURB_ could probably be set to a fixed value also, let me know what you prefer.

Not sure if at this point would be also the case to set G_SLICE=always-malloc to ensure that this has an effect even for data allocated with g-slices.

Merge request reports