From 3ae4dcd41e72d197e3882835253745f79588b04a Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Mon, 18 Jul 2011 12:02:26 -0700 Subject: 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. --- src/rt/rust_task.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/rt/rust_task.cpp') 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() { -- cgit 1.4.1-3-g733a5