summaryrefslogtreecommitdiff
path: root/src/base/types.hh
diff options
context:
space:
mode:
authorJordi Vaquero <jordi.vaquero@metempsy.com>2019-09-11 00:11:27 +0200
committerJordi Vaquero <jordi.vaquero@metempsy.com>2019-09-23 12:32:08 +0000
commite5a82da26e29560f3e7121b600a12f8acd6a5a3f (patch)
tree31786646cd8b077b48381303d0352959038e15a2 /src/base/types.hh
parenta56ab04598be184427e8dd71fa5528b016738306 (diff)
downloadgem5-e5a82da26e29560f3e7121b600a12f8acd6a5a3f.tar.xz
cpu, mem: Changing AtomicOpFunctor* for unique_ptr<AtomicOpFunctor>
This change is based on modify the way we move the AtomicOpFunctor* through gem5 in order to mantain proper ownership of the object and ensuring its destruction when it is no longer used. Doing that we fix at the same time a memory leak in Request.hh where we were assigning a new AtomicOpFunctor* without destroying the previous one. This change creates a new type AtomicOpFunctor_ptr as a std::unique_ptr<AtomicOpFunctor> and move its ownership as needed. Except for its only usage when AtomicOpFunc() is called. Change-Id: Ic516f9d8217cb1ae1f0a19500e5da0336da9fd4f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20919 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/base/types.hh')
-rw-r--r--src/base/types.hh2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/base/types.hh b/src/base/types.hh
index d99384529..453309416 100644
--- a/src/base/types.hh
+++ b/src/base/types.hh
@@ -259,6 +259,8 @@ struct TypedAtomicOpFunctor : public AtomicOpFunctor
virtual void execute(T * p) = 0;
};
+typedef std::unique_ptr<AtomicOpFunctor> AtomicOpFunctorPtr;
+
enum ByteOrder {
BigEndianByteOrder,
LittleEndianByteOrder