Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/8603


Change subject: mem-cache: Fix CacheSet memory leak
......................................................................

mem-cache: Fix CacheSet memory leak

CacheSet blocks were being allocated but never freed.
Used vector to avoid using pure C array.

Change-Id: I6f32fa5a305ff4e1d7602535026c1396764102ed
---
M src/mem/cache/tags/base_set_assoc.cc
M src/mem/cache/tags/cacheset.hh
2 files changed, 2 insertions(+), 2 deletions(-)



diff --git a/src/mem/cache/tags/base_set_assoc.cc b/src/mem/cache/tags/base_set_assoc.cc
index cf647ac..915bf34 100644
--- a/src/mem/cache/tags/base_set_assoc.cc
+++ b/src/mem/cache/tags/base_set_assoc.cc
@@ -84,7 +84,7 @@
     for (unsigned i = 0; i < numSets; ++i) {
         sets[i].assoc = assoc;

-        sets[i].blks = new BlkType*[assoc];
+        sets[i].blks.reserve(assoc);

         // link in the data blocks
         for (unsigned j = 0; j < assoc; ++j) {
diff --git a/src/mem/cache/tags/cacheset.hh b/src/mem/cache/tags/cacheset.hh
index 69109d1..5a34456 100644
--- a/src/mem/cache/tags/cacheset.hh
+++ b/src/mem/cache/tags/cacheset.hh
@@ -61,7 +61,7 @@
     int assoc;

     /** Cache blocks in this set, maintained in LRU order 0 = MRU. */
-    Blktype **blks;
+    std::vector<Blktype*> blks;

     /**
      * Find a block matching the tag in this set.

--
To view, visit https://gem5-review.googlesource.com/8603
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I6f32fa5a305ff4e1d7602535026c1396764102ed
Gerrit-Change-Number: 8603
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to