Skip to content

Commit bda1f84

Browse files
committed
---
yaml --- r: 149183 b: refs/heads/try2 c: aaead93 h: refs/heads/master i: 149181: 602aa66 149179: 8a06c41 149175: a0e2530 149167: 8146860 149151: 173e96d 149119: ae9fb3a v: v3
1 parent 723cf56 commit bda1f84

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d5e0622f95252e442b909011129336c11ddb0151
8+
refs/heads/try2: aaead93c4554b685935b70565fc1bb54edd945d6
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/rt/local_heap.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rt::local::Local;
2323
use rt::task::Task;
2424
use unstable::raw;
2525
use vec::ImmutableVector;
26+
use vec_ng::Vec;
2627

2728
// This has no meaning with out rtdebug also turned on.
2829
#[cfg(rtdebug)]
@@ -33,7 +34,7 @@ static MAGIC: u32 = 0xbadc0ffe;
3334
pub type Box = raw::Box<()>;
3435

3536
pub struct MemoryRegion {
36-
priv allocations: ~[*AllocHeader],
37+
priv allocations: Vec<*AllocHeader>,
3738
priv live_allocations: uint,
3839
}
3940

@@ -48,7 +49,7 @@ impl LocalHeap {
4849
#[inline]
4950
pub fn new() -> LocalHeap {
5051
let region = MemoryRegion {
51-
allocations: ~[],
52+
allocations: Vec::new(),
5253
live_allocations: 0,
5354
};
5455
LocalHeap {
@@ -248,8 +249,8 @@ impl MemoryRegion {
248249
fn release(&mut self, alloc: &AllocHeader) {
249250
alloc.assert_sane();
250251
if TRACK_ALLOCATIONS > 1 {
251-
rtassert!(self.allocations[alloc.index] == alloc as *AllocHeader);
252-
self.allocations[alloc.index] = ptr::null();
252+
rtassert!(self.allocations.as_slice()[alloc.index] == alloc as *AllocHeader);
253+
self.allocations.as_mut_slice()[alloc.index] = ptr::null();
253254
}
254255
}
255256
#[cfg(not(rtdebug))]
@@ -260,8 +261,8 @@ impl MemoryRegion {
260261
fn update(&mut self, alloc: &mut AllocHeader, orig: *AllocHeader) {
261262
alloc.assert_sane();
262263
if TRACK_ALLOCATIONS > 1 {
263-
rtassert!(self.allocations[alloc.index] == orig);
264-
self.allocations[alloc.index] = &*alloc as *AllocHeader;
264+
rtassert!(self.allocations.as_slice()[alloc.index] == orig);
265+
self.allocations.as_mut_slice()[alloc.index] = &*alloc as *AllocHeader;
265266
}
266267
}
267268
#[cfg(not(rtdebug))]
@@ -274,7 +275,7 @@ impl Drop for MemoryRegion {
274275
if self.live_allocations != 0 {
275276
rtabort!("leaked managed memory ({} objects)", self.live_allocations);
276277
}
277-
rtassert!(self.allocations.iter().all(|s| s.is_null()));
278+
rtassert!(self.allocations.as_slice().iter().all(|s| s.is_null()));
278279
}
279280
}
280281

0 commit comments

Comments
 (0)