-
Notifications
You must be signed in to change notification settings - Fork 161
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
Improve valgrind support #2718
Improve valgrind support #2718
Conversation
src/gasman.c
Outdated
*/ | ||
|
||
Bag * NewWeakDeadBagMarker = (Bag *)(1000*sizeof(Bag) + 1L); | ||
Bag * OldWeakDeadBagMarker = (Bag *)(1001*sizeof(Bag) + 1L); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this moved around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to refer to it in an earlier place in the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But turns out I didn't end up using that. Taken this part of the PR out.
src/gasman.c
Outdated
Int bufsize = (Int)EndBags - (Int)AllocBags; | ||
return bufsize < 4096 ? bufsize : 4096; | ||
VALGRIND_MAKE_MEM_DEFINED(bag, sizeof(Bag)); | ||
char* ptr = (char*)PTR_BAG(bag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format the new code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All formatted
src/gasman.c
Outdated
@@ -2043,7 +2094,7 @@ UInt CollectBags ( | |||
/* free the identifier */ | |||
*(Bag*)(header->link) = FreeMptrBags; | |||
FreeMptrBags = header->link; | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still is in the diff? But anyway, not important
df9b4fc
to
632b5f1
Compare
src/gasman.c
Outdated
@@ -202,11 +202,23 @@ enum { | |||
}; | |||
|
|||
|
|||
static inline UInt WORDS_BAG(UInt size) | |||
// BAG_SLACK is used to define a block of empty space at the end of each | |||
// bag, which can then be marked as "not accessable" in the memory checker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: accessable -> accessible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/gasman.c
Outdated
@@ -2043,7 +2094,7 @@ UInt CollectBags ( | |||
/* free the identifier */ | |||
*(Bag*)(header->link) = FreeMptrBags; | |||
FreeMptrBags = header->link; | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still is in the diff? But anyway, not important
632b5f1
to
77f4dce
Compare
Codecov Report
@@ Coverage Diff @@
## master #2718 +/- ##
==========================================
+ Coverage 75.75% 75.75% +<.01%
==========================================
Files 478 478
Lines 241495 241576 +81
==========================================
+ Hits 182938 183005 +67
- Misses 58557 58571 +14
|
There is now a merge commit by @markuspf in here. Perhaps @ChrisJefferson can rebase the PR once again to get rid of that? |
281c177
to
b47d368
Compare
This patch greatly improves --enable-valgrind. This puts padding before and after every Bag, so we can detect invalid reads or writes off the beginning and end of every Bag