Skip to content
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

Introduce Valgrind to the CI pipeline #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henrybear327
Copy link
Collaborator

@henrybear327 henrybear327 commented Mar 1, 2024

The static analyzer alone can't catch all the runtime issues. In this commit, the dynamic analysis tool Valgrind is added to the CI pipeline.

ENABLE_SDL is set to 0, in order to reduce noise caused by the external
libraries.

Reference:

@henrybear327
Copy link
Collaborator Author

henrybear327 commented Mar 1, 2024

To merge this pull request, all the memory-related leaks need to be addressed first.

Currently, based on my initial testing, when disabling SDL and JIT, no memory leaks are found. When enabling JIT, there will be plenty of leaks.

The static analyzer alone can't catch all the runtime issues. In this 
commit, the dynamic analysis tool Valgrind is added to the CI pipeline.

ENABLE_SDL is set to 0, in order to reduce noise caused by the external
libraries.

Reference:
- https://valgrind.org/docs/manual/quick-start.html
- https://linux.die.net/man/1/gcc
@@ -11,6 +11,14 @@ CFLAGS = -std=gnu99 -O2 -Wall -Wextra
CFLAGS += -Wno-unused-label
CFLAGS += -include src/common.h

ENABLE_VALGRIND ?= 0
ifeq ("$(ENABLE_UBSAN)", "1")
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like a typo to me. Did you mean 'ENABLE_VALGRIND' instead of 'ENABLE_UBSAN'?

# according to gcc's man page: "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective."
# In order to use Valgrind, we need to compile with -g
CFLAGS += -g
LDFLAGS += -g
Copy link
Collaborator

Choose a reason for hiding this comment

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

The '-g' flag is not specifically designed for valgrind. Have you considered using a different name such as ENABLE_DEBUG instead of ENABLE_VALGRIND?

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.

None yet

2 participants