changeset 939f3919b108 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=939f3919b108
description:
        ruby: Fix CacheMemory allocate leak

        If a cache entry permission was previously set to NotPresent, but the 
entry was
        not deleted, a following cache allocation can cause the entry to be 
leaked by
        setting the entry pointer to a newly allocated entry. To eliminate this
        possibility, check if the new entry is different from the old one, and 
if so,
        delete the old one.

diffstat:

 src/mem/ruby/structures/CacheMemory.cc |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (17 lines):

diff -r 90eeefe7e341 -r 939f3919b108 src/mem/ruby/structures/CacheMemory.cc
--- a/src/mem/ruby/structures/CacheMemory.cc    Tue Sep 29 09:28:26 2015 -0500
+++ b/src/mem/ruby/structures/CacheMemory.cc    Tue Sep 29 09:28:26 2015 -0500
@@ -263,6 +263,13 @@
     std::vector<AbstractCacheEntry*> &set = m_cache[cacheSet];
     for (int i = 0; i < m_cache_assoc; i++) {
         if (!set[i] || set[i]->m_Permission == AccessPermission_NotPresent) {
+            if (set[i] && (set[i] != entry)) {
+                warn_once("This protocol contains a cache entry handling bug: "
+                    "Entries in the cache should never be NotPresent! If\n"
+                    "this entry (%#x) is not tracked elsewhere, it will memory 
"
+                    "leak here. Fix your protocol to eliminate these!",
+                    address);
+            }
             set[i] = entry;  // Init entry
             set[i]->m_Address = address;
             set[i]->m_Permission = AccessPermission_Invalid;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to