mem: Add cache class destructor to avoid memory leaks
Make valgrind a little bit happier
This commit is contained in:
3
src/mem/cache/cache.hh
vendored
3
src/mem/cache/cache.hh
vendored
@@ -411,6 +411,9 @@ class Cache : public BaseCache
|
||||
/** Instantiates a basic cache object. */
|
||||
Cache(const Params *p);
|
||||
|
||||
/** Non-default destructor is needed to deallocate memory. */
|
||||
virtual ~Cache();
|
||||
|
||||
void regStats();
|
||||
|
||||
/** serialize the state of the caches
|
||||
|
||||
10
src/mem/cache/cache_impl.hh
vendored
10
src/mem/cache/cache_impl.hh
vendored
@@ -83,6 +83,16 @@ Cache<TagStore>::Cache(const Params *p)
|
||||
prefetcher->setCache(this);
|
||||
}
|
||||
|
||||
template<class TagStore>
|
||||
Cache<TagStore>::~Cache()
|
||||
{
|
||||
delete [] tempBlock->data;
|
||||
delete tempBlock;
|
||||
|
||||
delete cpuSidePort;
|
||||
delete memSidePort;
|
||||
}
|
||||
|
||||
template<class TagStore>
|
||||
void
|
||||
Cache<TagStore>::regStats()
|
||||
|
||||
Reference in New Issue
Block a user