summaryrefslogtreecommitdiff
path: root/src/ToolBox
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2019-04-18 13:36:25 -0400
committerMike McLaughlin <mikem@microsoft.com>2019-04-18 10:36:25 -0700
commit12d7055fe427c6ab4d8c04d28a9f6a35ade6815c (patch)
treebe35c44e4b2b1e30a44d4fd9f124a24b5b1a593a /src/ToolBox
parent42b5509b1b8f3be12876579aa23a3cb3ed2ca7a4 (diff)
downloadcoreclr-12d7055fe427c6ab4d8c04d28a9f6a35ade6815c.tar.gz
coreclr-12d7055fe427c6ab4d8c04d28a9f6a35ade6815c.tar.bz2
coreclr-12d7055fe427c6ab4d8c04d28a9f6a35ade6815c.zip
Add a destructor for sos::GCHeap (#24072)
The constructor allocates memory via new[]. It should be freed up via delete[] by a destructor to avoid a memory leak.
Diffstat (limited to 'src/ToolBox')
-rw-r--r--src/ToolBox/SOS/Strike/sos.cpp5
-rw-r--r--src/ToolBox/SOS/Strike/sos.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/ToolBox/SOS/Strike/sos.cpp b/src/ToolBox/SOS/Strike/sos.cpp
index bf84e1d8af..4aacc2a2e7 100644
--- a/src/ToolBox/SOS/Strike/sos.cpp
+++ b/src/ToolBox/SOS/Strike/sos.cpp
@@ -795,6 +795,11 @@ namespace sos
}
}
+ GCHeap::~GCHeap()
+ {
+ delete [] mHeaps;
+ }
+
ObjectIterator GCHeap::WalkHeap(TADDR start, TADDR stop) const
{
return ObjectIterator(mHeaps, mNumHeaps, start, stop);
diff --git a/src/ToolBox/SOS/Strike/sos.h b/src/ToolBox/SOS/Strike/sos.h
index 80608dd371..4d154ef76f 100644
--- a/src/ToolBox/SOS/Strike/sos.h
+++ b/src/ToolBox/SOS/Strike/sos.h
@@ -752,6 +752,8 @@ namespace sos
*/
GCHeap();
+ ~GCHeap();
+
/* Returns an ObjectIterator which allows you to walk the objects on the managed heap.
* This ObjectIterator is valid for the duration of the GCHeap's lifetime. Note that
* if you specify an address at which you wish to start walking the heap it need