diff options
author | Joel Hestness <jthestness@gmail.com> | 2015-09-29 09:28:25 -0500 |
---|---|---|
committer | Joel Hestness <jthestness@gmail.com> | 2015-09-29 09:28:25 -0500 |
commit | b80024ee7dc1dd424ce2dd907e7b7e3a902e0bb2 (patch) | |
tree | 0468c1f3a85cb733b36a95389f38b6548aba479e | |
parent | 7b70fa02aef5d38d1d5b583193cb1577f050d937 (diff) | |
download | gem5-b80024ee7dc1dd424ce2dd907e7b7e3a902e0bb2.tar.xz |
ruby: RubyPort delete snoop requests
In RubyPort::ruby_eviction_callback, prior changes fixed a memory leak caused
by instantiating separate packets for each port that the eviction was forwarded
to. That change, however, left the instantiated request to also leak. Allocate
it on the stack to avoid the leak.
-rw-r--r-- | src/mem/ruby/system/RubyPort.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mem/ruby/system/RubyPort.cc b/src/mem/ruby/system/RubyPort.cc index e03d23774..b2fb8d72d 100644 --- a/src/mem/ruby/system/RubyPort.cc +++ b/src/mem/ruby/system/RubyPort.cc @@ -505,13 +505,14 @@ void RubyPort::ruby_eviction_callback(Addr address) { DPRINTF(RubyPort, "Sending invalidations.\n"); - // This request is deleted in the stack-allocated packet destructor - // when this function exits + // Allocate the invalidate request and packet on the stack, as it is + // assumed they will not be modified or deleted by receivers. // TODO: should this really be using funcMasterId? - RequestPtr req = new Request(address, 0, 0, Request::funcMasterId); + Request request(address, RubySystem::getBlockSizeBytes(), 0, + Request::funcMasterId); // Use a single packet to signal all snooping ports of the invalidation. // This assumes that snooping ports do NOT modify the packet/request - Packet pkt(req, MemCmd::InvalidateReq); + Packet pkt(&request, MemCmd::InvalidateReq); for (CpuPortIter p = slave_ports.begin(); p != slave_ports.end(); ++p) { // check if the connected master port is snooping if ((*p)->isSnooping()) { |