From b7cc66af311923610d612463d401447fb814f258 Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Wed, 18 Nov 2009 13:55:57 -0800 Subject: [PATCH] ruby: Ruby destruction fix. --- src/mem/ruby/common/DataBlock.hh | 6 +++++- src/mem/ruby/common/NetDest.hh | 2 +- src/mem/ruby/network/simple/SimpleNetwork.cc | 2 +- src/mem/rubymem.cc | 7 ++++--- src/mem/rubymem.hh | 3 +++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh index 3c8ef56f4..1d399753e 100644 --- a/src/mem/ruby/common/DataBlock.hh +++ b/src/mem/ruby/common/DataBlock.hh @@ -45,7 +45,11 @@ class DataBlock { } // Destructor - ~DataBlock() { if(m_alloc) delete [] m_data;} + ~DataBlock() { + if(m_alloc) { + delete [] m_data; + } + } DataBlock& operator=(const DataBlock& obj); diff --git a/src/mem/ruby/common/NetDest.hh b/src/mem/ruby/common/NetDest.hh index 1dcee7b7a..7301409ce 100644 --- a/src/mem/ruby/common/NetDest.hh +++ b/src/mem/ruby/common/NetDest.hh @@ -63,7 +63,7 @@ public: NetDest& operator=(const Set& obj); // Destructor - // ~NetDest(); + ~NetDest() { DEBUG_MSG(MEMORY_COMP, LowPrio, "NetDest Destructor"); } // Public Methods void add(MachineID newElement); diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index 497c602d1..1a45340ed 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -124,7 +124,7 @@ SimpleNetwork::~SimpleNetwork() } m_switch_ptr_vector.deletePointers(); m_buffers_to_free.deletePointers(); - delete m_topology_ptr; + // delete m_topology_ptr; } // From a switch to an endpoint node diff --git a/src/mem/rubymem.cc b/src/mem/rubymem.cc index 2fb529e12..14b2048a0 100644 --- a/src/mem/rubymem.cc +++ b/src/mem/rubymem.cc @@ -60,7 +60,7 @@ RubyMemory::RubyMemory(const Params *p) vector sys_conf; while (!config.eof()) { - char buffer[4096]; + char buffer[65536]; config.getline(buffer, sizeof(buffer)); string line = buffer; if (line.empty()) @@ -119,8 +119,8 @@ RubyMemory::init() } //Print stats at exit - RubyExitCallback* rc = new RubyExitCallback(this); - registerExitCallback(rc); + rubyExitCB = new RubyExitCallback(this); + registerExitCallback(rubyExitCB); //Sched RubyEvent, automatically reschedules to advance ruby cycles rubyTickEvent = new RubyEvent(this); @@ -138,6 +138,7 @@ RubyMemory::tick() RubyMemory::~RubyMemory() { + delete g_system_ptr; } void diff --git a/src/mem/rubymem.hh b/src/mem/rubymem.hh index e33418a42..1bfb135e8 100644 --- a/src/mem/rubymem.hh +++ b/src/mem/rubymem.hh @@ -40,6 +40,8 @@ #include "mem/ruby/system/RubyPort.hh" #include "params/RubyMemory.hh" +class RubyExitCallback; + class RubyMemory : public PhysicalMemory { public: @@ -119,6 +121,7 @@ class RubyMemory : public PhysicalMemory private: Tick ruby_clock; Tick ruby_phase; + RubyExitCallback* rubyExitCB; public: static std::map pending_requests; -- 2.30.2