Fix: Address a few benign memory leaks
This patch is the result of static analysis identifying a number of memory leaks. The leaks are all benign as they are a result of not deallocating memory in the desctructor. The fix still has value as it removes false positives in the static analysis.
This commit is contained in:
@@ -46,6 +46,11 @@ ActivityRecorder::ActivityRecorder(const string &name, int num_stages,
|
||||
std::memset(stageActive, 0, numStages);
|
||||
}
|
||||
|
||||
ActivityRecorder::~ActivityRecorder()
|
||||
{
|
||||
delete[] stageActive;
|
||||
}
|
||||
|
||||
void
|
||||
ActivityRecorder::activity()
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@ class ActivityRecorder
|
||||
public:
|
||||
ActivityRecorder(const std::string &name, int num_stages,
|
||||
int longest_latency, int count);
|
||||
~ActivityRecorder();
|
||||
|
||||
/** Records that there is activity this cycle. */
|
||||
void activity();
|
||||
|
||||
@@ -243,6 +243,9 @@ BaseCPU::enableFunctionTrace()
|
||||
|
||||
BaseCPU::~BaseCPU()
|
||||
{
|
||||
delete profileEvent;
|
||||
delete[] comLoadEventQueue;
|
||||
delete[] comInstEventQueue;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -75,6 +75,11 @@ class PhysRegFile
|
||||
PhysRegFile(O3CPU *_cpu, unsigned _numPhysicalIntRegs,
|
||||
unsigned _numPhysicalFloatRegs);
|
||||
|
||||
/**
|
||||
* Destructor to free resources
|
||||
*/
|
||||
~PhysRegFile();
|
||||
|
||||
//Everything below should be pretty well identical to the normal
|
||||
//register file that exists within AlphaISA class.
|
||||
//The duplication is unfortunate but it's better than having
|
||||
@@ -197,4 +202,11 @@ PhysRegFile<Impl>::PhysRegFile(O3CPU *_cpu, unsigned _numPhysicalIntRegs,
|
||||
memset(floatRegFile, 0, sizeof(PhysFloatReg) * numPhysicalFloatRegs);
|
||||
}
|
||||
|
||||
template <class Impl>
|
||||
PhysRegFile<Impl>::~PhysRegFile()
|
||||
{
|
||||
delete intRegFile;
|
||||
delete floatRegFile;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user