Skip to content

Commit 48b4030

Browse files
committed
Make -Zmiri-tag-gc=0 disable the GC, document the flag
1 parent ed0efe2 commit 48b4030

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ environment variable. We first document the most relevant and most commonly used
323323
ensure alignment. (The standard library `align_to` method works fine in both modes; under
324324
symbolic alignment it only fills the middle slice when the allocation guarantees sufficient
325325
alignment.)
326+
* `-Zmiri-tag-gc=<blocks>` configures how often the pointer tag garbage collector runs. The default
327+
is to search for and remove unreachable tags once every `10,000` basic blocks. Setting this to
328+
`0` disables the garbage collector, which causes some programs to have explosive memory usage
329+
and/or super-linear runtime.
326330

327331
The remaining flags are for advanced use only, and more likely to change or be removed.
328332
Some of these are **unsound**, which means they can lead

src/machine.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,9 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
971971
// stacks.
972972
// When debug assertions are enabled, run the GC as often as possible so that any cases
973973
// where it mistakenly removes an important tag become visible.
974-
if ecx.machine.since_gc >= ecx.machine.gc_interval || cfg!(debug_assertions) {
974+
if cfg!(debug_assertions)
975+
|| (ecx.machine.gc_interval > 0 && ecx.machine.since_gc >= ecx.machine.gc_interval)
976+
{
975977
ecx.machine.since_gc = 0;
976978
ecx.garbage_collect_tags()?;
977979
} else {

0 commit comments

Comments
 (0)