From 8296be8a11be6d2b2972ec3ea577443147e4ead5 Mon Sep 17 00:00:00 2001 From: kurtliu Date: Wed, 24 Jan 2024 16:14:50 +0800 Subject: [PATCH] fix: unecessary memory reserve --- physx/source/common/src/CmCollection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physx/source/common/src/CmCollection.cpp b/physx/source/common/src/CmCollection.cpp index 96bdbf79e..d37692715 100644 --- a/physx/source/common/src/CmCollection.cpp +++ b/physx/source/common/src/CmCollection.cpp @@ -112,7 +112,7 @@ void Collection::add(PxCollection& _collection) Collection& collection = static_cast(_collection); PX_CHECK_AND_RETURN(this != &collection, "PxCollection::add(PxCollection&) called with itself!"); - mObjects.reserve(mObjects.capacity() + collection.mObjects.size()); + mObjects.reserve(mObjects.size() + collection.mObjects.size()); const ObjectToIdMap::Entry* e = collection.mObjects.getEntries(); for (PxU32 i = 0; i < collection.mObjects.size(); ++i) {