diff options
| author | Eric Holk <eholk@mozilla.com> | 2011-07-18 12:02:26 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-07-21 11:51:22 -0700 |
| commit | 3ae4dcd41e72d197e3882835253745f79588b04a (patch) | |
| tree | 38b0fa41afe156057c8913f779fda2e4ca0b08ac /src/rt/rust_task.cpp | |
| parent | a44fb04d57400f70ad58c1e35fc9dd9a7c43de07 (diff) | |
| download | rust-3ae4dcd41e72d197e3882835253745f79588b04a.tar.gz rust-3ae4dcd41e72d197e3882835253745f79588b04a.zip | |
Lots of work on memory tracking and channels.
We're trying to get closer to doing correct move semantics for channel operations. This involves a lot of cleanup (such as removing the unused sched parameter from rust_vec constructor) and making circular_buffer kernel_owned. Added tagging for memory allocations. This means we give a string tag to everything we allocate. If we leak something and TRACK_ALLOCATIONS is enabled, then it's much easier now to tell exactly what is leaking.
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index d56cb8b6276..2b33e3d773a 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -34,7 +34,7 @@ new_stk(rust_task *task, size_t minsz) if (minsz < min_stk_bytes) minsz = min_stk_bytes; size_t sz = sizeof(stk_seg) + minsz; - stk_seg *stk = (stk_seg *)task->malloc(sz); + stk_seg *stk = (stk_seg *)task->malloc(sz, "stack"); LOGPTR(task->sched, "new stk", (uintptr_t)stk); memset(stk, 0, sizeof(stk_seg)); stk->limit = (uintptr_t) &stk->data[minsz]; @@ -326,7 +326,7 @@ rust_task::unlink_gc(gc_alloc *gcm) { } void * -rust_task::malloc(size_t sz, type_desc *td) +rust_task::malloc(size_t sz, const char *tag, type_desc *td) { // FIXME: GC is disabled for now. // GC-memory classification is all wrong. @@ -335,7 +335,8 @@ rust_task::malloc(size_t sz, type_desc *td) if (td) { sz += sizeof(gc_alloc); } - void *mem = local_region.malloc(sz); + + void *mem = local_region.malloc(sz, tag); if (!mem) return mem; if (td) { @@ -488,8 +489,8 @@ bool rust_task::can_schedule(int id) } void * -rust_task::calloc(size_t size) { - return local_region.calloc(size); +rust_task::calloc(size_t size, const char *tag) { + return local_region.calloc(size, tag); } void rust_task::pin() { |
