rust/src/rt/memory.h
Eric Holk 3ae4dcd41e 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.
2011-07-21 11:51:22 -07:00

41 lines
1.2 KiB
C++

// -*- c++ -*-
#ifndef MEMORY_H
#define MEMORY_H
// FIXME: It would be really nice to be able to get rid of this.
inline void *operator new[](size_t size, rust_task *task, const char *tag) {
return task->malloc(size, tag);
}
template <typename T>
inline void *task_owned<T>::operator new(size_t size, rust_task *task,
const char *tag) {
return task->malloc(size, tag);
}
template <typename T>
inline void *task_owned<T>::operator new[](size_t size, rust_task *task,
const char *tag) {
return task->malloc(size, tag);
}
template <typename T>
inline void *task_owned<T>::operator new(size_t size, rust_task &task,
const char *tag) {
return task.malloc(size, tag);
}
template <typename T>
inline void *task_owned<T>::operator new[](size_t size, rust_task &task,
const char *tag) {
return task.malloc(size, tag);
}
template <typename T>
inline void *kernel_owned<T>::operator new(size_t size, rust_kernel *kernel,
const char *tag) {
return kernel->malloc(size, tag);
}
#endif /* MEMORY_H */