forked from ged/ruby-pg
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possible segfaults after GC.compact
This adds several rb_gc_mark calls for VALUEs that were only implicit marked before. This is because ruby-2.7 adds a second meaning to rb_gc_mark(). It not only marks a VALUE as in use, but also marks the VALUE as unmoveable, so that it's pinned to one memory address. In ruby < 2.7 is was sufficient to mark objects that otherwise would freed by GC. So there was no need to mark objects that were implicit in use, like self references. Strating with ruby-2.7 these objects must be marked as well. Alternatively C extentions can use compatation callbacks to update VALUE references. I verified that this patch is effective to fix these issues by placing several instances of the following line into specs: GC.verify_compaction_references(toward: :empty, double_heap: true) Unfortunately GC.verify_compaction_references is not suitable to be added regulary to the specs, because every instance of this call doubles the process memory in use. See also GC.compact discussion: https://bugs.ruby-lang.org/issues/15626#Known-Issue Fixes ged#327 Fixes ged#328
- Loading branch information
Showing
5 changed files
with
24 additions
and
5 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
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