From 082060c34fae6ce6228c84b008b19aaa18e7a7c7 Mon Sep 17 00:00:00 2001 From: David Abram Cargill <cargilld@apache.org> Date: Fri, 11 Mar 2005 17:03:36 +0000 Subject: [PATCH] Patch from David Earlam for XERCESC-1363. Increase size of BaseRefVectorOf based on size of data not by 32. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@176341 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/util/BaseRefVectorOf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/xercesc/util/BaseRefVectorOf.c b/src/xercesc/util/BaseRefVectorOf.c index 49f8f0162..b7ba22a9c 100644 --- a/src/xercesc/util/BaseRefVectorOf.c +++ b/src/xercesc/util/BaseRefVectorOf.c @@ -267,9 +267,10 @@ ensureExtraCapacity(const unsigned int length) if (newMax <= fMaxCount) return; - // Avoid too many reallocations by providing a little more space - if (newMax < fMaxCount + 32) - newMax = fMaxCount + 32; + // Choose how much bigger based on the current size. + // This will grow half as much again. + if (newMax < fMaxCount + fMaxCount/2) + newMax = fMaxCount + fMaxCount/2; // Allocate the new array and copy over the existing stuff TElem** newList = (TElem**) fMemoryManager->allocate -- GitLab