Skip to content

feat. Add valgrind on PR #236

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

Merged
merged 1 commit into from
Apr 3, 2025
Merged

Conversation

remiolivier-discord
Copy link
Contributor

Add some memory leak checks for lilliput

Testing memory leaks with valgrind, c++ and Go is a little hard but we can add basic checks in definitely lost and indirectly lost at least for the c++ code we call underneath.
We had a few regression in the past showing issues with these 2 and these checks while not extensive will already go a long way.

for test_case in "${test_cases[@]}"; do
read -r height width input output <<< "$test_case"
echo "Testing with height=$height width=$width input=$input output=$output"
VALGRIND_OUT=$(valgrind --leak-check=full ./example \
Copy link
Contributor

@salarkhan salarkhan Apr 3, 2025

Choose a reason for hiding this comment

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

consider adding --show-leak-kinds=all?

"Definitely lost": Memory that was allocated but never freed
"Indirectly lost": Memory that was allocated but lost due to losing pointers to it
"Possibly lost": Memory that Valgrind can't determine if you have a pointer to
"Still reachable": Memory that wasn't freed but a pointer to it still exists
"Suppressed": Memory leaks that were suppressed via suppression files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is with go we will always get possibly lost and still reachable because of its GC. So here we will just care about the most important leaks

Copy link
Contributor

@salarkhan salarkhan Apr 3, 2025

Choose a reason for hiding this comment

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

yeah, but i figured it might be nice to at least have the output. if possibly lost / still reachable has a huge increase we'd still want to know, no? not a strong opinion here though, agreed that the important ones are already covered

@remiolivier-discord remiolivier-discord merged commit 4b08672 into master Apr 3, 2025
3 checks passed
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.

2 participants