-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
memory: Fix bug flagging permament memory when AST is configured --wi…
…th-memdebug If AST is configured with the --with-memdebug flag, then each mmemory block allocated internally by AST includes a boolean flag indicating if it is considered "permament" (i.e. it is never freed). The value of this flag is determined by whether or not the allocation occurs between a pair of matching calls to astBeginPM and astEndPM. A bug has existed for a long time which leads to spurious values sometimes being used for the flag when different threads try to allocate such permanent memory blocks simultaneously. This commit fixes this bug by using a mutex to serialise access to astBeginPM and astEndPm. There is some complication because astBeginPM/astEndPM blocks can be nested. This requires each thread to keep track of its own level of nesting, so that the mutex can be locked and unlocked only on the top level calls to astBeginPM and astEndPM.
- Loading branch information
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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