Open
Conversation
Does a partial GC before constructing new case objects to ensure there are enough free nodes to finish construction and add it to a root node before the GC runs again. Case objects must be marked twice so if the GC runs after a new case is allocated but before it is added to the hash table AND a root AND the pointer isn't found on the stack, eg because it was optimized out, then the GC may free the cases. I was concerned this would have a negative performance impact... It actually improved unit test performance by 10-20%. ¯\_(ツ)_/¯
Found by ASAN
long int loses precision on 64 bit systems leading to possible crashing
This will help detect GC errors like use after free Or use before alloc
Contributor
Author
|
As a followon it would be good to run CI tests on an ASAN build as well as release |
jrincayc
reviewed
Mar 29, 2025
Comment on lines
+29
to
+33
| set $NT_LIST=010000 | ||
| set $NT_TREE=0100000 | ||
| set $NT_AGGR=020000 | ||
| set $NT_EMPTY=040000 | ||
| set $NT_CASEOBJ=000001 |
Owner
There was a problem hiding this comment.
Hm, these might be redundant since this is now part of the NodeTypes enum.
Contributor
Author
There was a problem hiding this comment.
I cut and pasted directly from the enum. They are redundant, but because these symbols are not defined in every scope GDB might break in, if the program is even still running (eg after a segfault), I came up with this.
There could be a better way, IDK. Probably not worth more effort unless you mean to use them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR integrates address sanitizer, the most popular memory checker for C. All C projects should be using memory checking tools. ASAN is on par with valgrind, but much faster.
ASAN requires minor code changes for garbage collectors.
ASAN is only for debug builds due to added overhead, so these changes are guarded by
#ifdef __SANITIZE_ADDRESS__.I also threw in some GDB tools I created and fixed a couple of small bugs along the way.