Debugger: Further work on memory leak hunting.
TeamWindow: - Properly delete stack frame selection entries in destructor. TeamDebugger: - The reference to TeamDebugInfo wasn't correctly initialized to own, leading to TeamDebugInfo never being destroyed. FunctionInstance: - Also clear source code reference in destructor. ImageDebugInfo: - Release references to specific infos in destructor. These are acquired on our behalf when loading the image info, but were never released, leading to the latter never being freed. DwarfManager: - Release references to files in destructor. FileManager: - Release entries in various destructors. Somewhat improves the situation in #13800, but is still far from complete, as a thorough review of this nature hasn't ever really been done.
This commit is contained in:
parent
8bb774fc37
commit
3d9b569384
@ -282,6 +282,16 @@ TeamWindow::~TeamWindow()
|
|||||||
_SetActiveThread(NULL);
|
_SetActiveThread(NULL);
|
||||||
|
|
||||||
delete fFilePanel;
|
delete fFilePanel;
|
||||||
|
|
||||||
|
ThreadStackFrameSelectionEntry* entry
|
||||||
|
= fThreadSelectionInfoTable->Clear(true);
|
||||||
|
|
||||||
|
while (entry != NULL) {
|
||||||
|
ThreadStackFrameSelectionEntry* next = entry->next;
|
||||||
|
delete entry;
|
||||||
|
entry = next;
|
||||||
|
}
|
||||||
|
|
||||||
delete fThreadSelectionInfoTable;
|
delete fThreadSelectionInfoTable;
|
||||||
|
|
||||||
if (fActiveSourceWorker > 0)
|
if (fActiveSourceWorker > 0)
|
||||||
|
@ -366,7 +366,7 @@ TeamDebugger::Init(DebuggerInterface* interface, thread_id threadID, int argc,
|
|||||||
fFileManager);
|
fFileManager);
|
||||||
if (teamDebugInfo == NULL)
|
if (teamDebugInfo == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
BReference<TeamDebugInfo> teamDebugInfoReference(teamDebugInfo);
|
BReference<TeamDebugInfo> teamDebugInfoReference(teamDebugInfo, true);
|
||||||
|
|
||||||
error = teamDebugInfo->Init();
|
error = teamDebugInfo->Init();
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
|
@ -32,6 +32,7 @@ FunctionInstance::FunctionInstance(ImageDebugInfo* imageDebugInfo,
|
|||||||
FunctionInstance::~FunctionInstance()
|
FunctionInstance::~FunctionInstance()
|
||||||
{
|
{
|
||||||
SetFunction(NULL);
|
SetFunction(NULL);
|
||||||
|
SetSourceCode(NULL, FUNCTION_SOURCE_NOT_LOADED);
|
||||||
fFunctionDebugInfo->ReleaseReference();
|
fFunctionDebugInfo->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Copyright 2010-2013, Rene Gollent, rene@gollent.com.
|
* Copyright 2010-2017, Rene Gollent, rene@gollent.com.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -27,12 +27,18 @@ ImageDebugInfo::~ImageDebugInfo()
|
|||||||
{
|
{
|
||||||
for (int32 i = 0; FunctionInstance* function = fFunctions.ItemAt(i); i++)
|
for (int32 i = 0; FunctionInstance* function = fFunctions.ItemAt(i); i++)
|
||||||
function->ReleaseReference();
|
function->ReleaseReference();
|
||||||
|
|
||||||
|
for (int32 i = 0; SpecificImageDebugInfo* info = fSpecificInfos.ItemAt(i);
|
||||||
|
i++) {
|
||||||
|
info->ReleaseReference();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ImageDebugInfo::AddSpecificInfo(SpecificImageDebugInfo* info)
|
ImageDebugInfo::AddSpecificInfo(SpecificImageDebugInfo* info)
|
||||||
{
|
{
|
||||||
|
// NB: on success we take over the caller's reference to the info object
|
||||||
return fSpecificInfos.AddItem(info);
|
return fSpecificInfos.AddItem(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Copyright 2014, Rene Gollent, rene@gollent.com.
|
* Copyright 2014-2017, Rene Gollent, rene@gollent.com.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -25,6 +25,8 @@ DwarfManager::DwarfManager(uint8 addressSize)
|
|||||||
|
|
||||||
DwarfManager::~DwarfManager()
|
DwarfManager::~DwarfManager()
|
||||||
{
|
{
|
||||||
|
while (DwarfFile* file = fFiles.RemoveHead())
|
||||||
|
file->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
|
* Copyright 2011-2017, Rene Gollent, rene@gollent.com.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -118,6 +118,12 @@ public:
|
|||||||
|
|
||||||
~Domain()
|
~Domain()
|
||||||
{
|
{
|
||||||
|
LocatableEntry* entry = fEntries.Clear(true);
|
||||||
|
while (entry != NULL) {
|
||||||
|
LocatableEntry* next = entry->fNext;
|
||||||
|
entry->ReleaseReference();
|
||||||
|
entry = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t Init()
|
status_t Init()
|
||||||
@ -555,6 +561,13 @@ FileManager::~FileManager()
|
|||||||
{
|
{
|
||||||
delete fTargetDomain;
|
delete fTargetDomain;
|
||||||
delete fSourceDomain;
|
delete fSourceDomain;
|
||||||
|
|
||||||
|
SourceFileEntry* entry = fSourceFiles->Clear();
|
||||||
|
while (entry != NULL) {
|
||||||
|
SourceFileEntry* next = entry->next;
|
||||||
|
delete entry;
|
||||||
|
next = entry;
|
||||||
|
}
|
||||||
delete fSourceFiles;
|
delete fSourceFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user