Skip to content

Commit 6b43f8f

Browse files
committed
address review
1 parent 5ace308 commit 6b43f8f

File tree

3 files changed

+54
-13
lines changed

3 files changed

+54
-13
lines changed

no_alloc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"backtraces": {
3+
"mean": 2.3829520464,
4+
"stddev": 0.07651981051526706
5+
},
6+
"big-allocs": {
7+
"mean": 0.1673647059473684,
8+
"stddev": 0.013478818300072831
9+
},
10+
"mse": {
11+
"mean": 0.8133679916000001,
12+
"stddev": 0.050075600632164104
13+
},
14+
"range-iteration": {
15+
"mean": 4.243566763599999,
16+
"stddev": 0.03380701243732224
17+
},
18+
"serde1": {
19+
"mean": 2.589135003,
20+
"stddev": 0.0700829518878718
21+
},
22+
"serde2": {
23+
"mean": 5.955532229,
24+
"stddev": 0.20599769835375004
25+
},
26+
"slice-chunked": {
27+
"mean": 0.4702839168333333,
28+
"stddev": 0.017522346103318015
29+
},
30+
"slice-get-unchecked": {
31+
"mean": 0.8169163450000001,
32+
"stddev": 0.013873697449548328
33+
},
34+
"string-replace": {
35+
"mean": 0.5258388794,
36+
"stddev": 0.032950972318742694
37+
},
38+
"unicode": {
39+
"mean": 3.4562345727999997,
40+
"stddev": 0.11276913990962134
41+
},
42+
"zip-equal": {
43+
"mean": 3.0626452212,
44+
"stddev": 0.0554291549675083
45+
}
46+
}

src/alloc/isolated_alloc.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,12 @@ mod tests {
333333
}
334334
}
335335

336-
/// Checks that allocations of different sizes do not overlap. Not a freestanding
337-
/// test because we use it as part of `check_leaks()` also.
338-
fn no_overlaps(alloc: &mut IsolatedAlloc) {
336+
/// Checks that allocations of different sizes do not overlap, then for memory
337+
/// leaks that might have occurred.
338+
#[test]
339+
fn check_leaks_and_overlaps() {
340+
let mut alloc = IsolatedAlloc::new();
341+
339342
// Some random sizes and aligns
340343
let mut sizes = vec![32; 10];
341344
sizes.append(&mut vec![15; 4]);
@@ -374,16 +377,8 @@ mod tests {
374377
alloc.dealloc(ptr, layout);
375378
}
376379
}
377-
}
378-
379-
/// Check for memory leaks after repeated allocations and deallocations.
380-
#[test]
381-
fn check_leaks() {
382-
let mut alloc = IsolatedAlloc::new();
383-
// Generate some noise first so leaks can manifest
384-
no_overlaps(&mut alloc);
385380

386-
// And then verify that no memory was leaked
381+
// And then verify that no memory was leaked after all that
387382
assert!(alloc.page_ptrs.is_empty() && alloc.huge_ptrs.is_empty());
388383
}
389384
}

src/concurrency/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
906906
interp_ok(MiriAllocBytes::from_bytes(
907907
std::borrow::Cow::Borrowed(bytes),
908908
align,
909-
params.clone(),
909+
params,
910910
))
911911
},
912912
|ptr| this.global_root_pointer(ptr),

0 commit comments

Comments
 (0)