Fix performance issue with gcroot (#1344)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Tue, 14 Jul 2020 02:09:15 +0000 (22:09 -0400)
committerGitHub <noreply@github.com>
Tue, 14 Jul 2020 02:09:15 +0000 (22:09 -0400)
The std::List<t>::size() method was not guaranteed to be linear complexity
until C++11.  Apparently the Centos Containers we are using to build the
diagnostic repo do not have C+11 compliant StdLib headers installed.

src/SOS/Strike/gcroot.cpp

index 7297e2723de1c97e0ce7646e15497694e435644b..ba598df4e3eef1f61d68dd3d23b8650913e58b2b 100644 (file)
@@ -178,7 +178,7 @@ GCRootImpl::RootNode *GCRootImpl::NewNode(TADDR obj, MTInfo *mtInfo, bool fromDe
     // nodes unless we have to.  Instead we keep a stl list with free nodes to use.
     RootNode *toReturn = NULL;
 
-    if (mRootNewList.size())
+    if (!mRootNewList.empty())
     {
         toReturn = mRootNewList.back();
         mRootNewList.pop_back();