Remove hack_allow_leaks

Happy to close the loop on this one.

Issue #236
This commit is contained in:
Brian Anderson 2011-09-08 16:59:23 -07:00
parent d267e7486e
commit 22001d1dce
5 changed files with 3 additions and 28 deletions

View File

@ -26,7 +26,6 @@ export configure_test_task;
export joinable;
native "rust" mod rustrt {
fn hack_allow_leaks();
fn sched_threads() -> uint;
}
@ -325,12 +324,6 @@ fn configure_test_task() {
// If this task fails we don't want that failure to propagate to the
// test runner or else we couldn't keep running tests
task::unsupervise();
// FIXME (236): Hack supreme - unwinding doesn't work yet so if this
// task fails memory will not be freed correctly. This turns off the
// sanity checks in the runtime's memory region for the task, so that
// the test runner can continue.
rustrt::hack_allow_leaks();
}
// Local Variables:

View File

@ -15,13 +15,13 @@ memory_region::alloc_header *memory_region::get_header(void *mem) {
memory_region::memory_region(rust_srv *srv, bool synchronized) :
_srv(srv), _parent(NULL), _live_allocations(0),
_detailed_leaks(srv->env->detailed_leaks),
_synchronized(synchronized), _hack_allow_leaks(false) {
_synchronized(synchronized) {
}
memory_region::memory_region(memory_region *parent) :
_srv(parent->_srv), _parent(parent), _live_allocations(0),
_detailed_leaks(parent->_detailed_leaks),
_synchronized(parent->_synchronized), _hack_allow_leaks(false) {
_synchronized(parent->_synchronized) {
}
void memory_region::add_alloc() {
@ -127,18 +127,13 @@ memory_region::~memory_region() {
assert(leak_count == _live_allocations);
}
#endif
if (!_hack_allow_leaks && _live_allocations > 0) {
if (_live_allocations > 0) {
_srv->fatal(msg, __FILE__, __LINE__,
"%d objects", _live_allocations);
}
if (_synchronized) { _lock.unlock(); }
}
void
memory_region::hack_allow_leaks() {
_hack_allow_leaks = true;
}
void
memory_region::release_alloc(void *mem) {
alloc_header *alloc = get_header(mem);

View File

@ -32,7 +32,6 @@ private:
const bool _detailed_leaks;
const bool _synchronized;
lock_and_signal _lock;
bool _hack_allow_leaks;
void add_alloc();
void dec_alloc();
@ -46,10 +45,6 @@ public:
void *realloc(void *mem, size_t size);
void free(void *mem);
virtual ~memory_region();
// FIXME (236: This is a temporary hack to allow failing tasks that leak
// to not kill the entire process, which the test runner needs. Please
// kill with prejudice once unwinding works.
void hack_allow_leaks();
void release_alloc(void *mem);
void claim_alloc(void *mem);

View File

@ -224,13 +224,6 @@ debug_opaque(rust_task *task, type_desc *t, uint8_t *front)
}
}
extern "C" CDECL void
hack_allow_leaks(rust_task *task)
{
LOG(task, stdlib, "hack_allow_leaks");
task->local_region.hack_allow_leaks();
}
struct rust_box {
RUST_REFCOUNTED(rust_box)

View File

@ -28,7 +28,6 @@ get_task_id
get_task_pointer
get_task_trampoline
get_time
hack_allow_leaks
last_os_error
leak
migrate_alloc