Added stream pool shrinking if large parts are unused.

This commit is contained in:
Armin Novak 2014-06-11 14:38:20 +02:00
parent 33b4407314
commit fb4fd9f5bb
1 changed files with 5 additions and 0 deletions

View File

@ -182,6 +182,11 @@ void StreamPool_Return(wStreamPool* pool, wStream* s)
pool->aCapacity *= 2;
pool->aArray = (wStream**) realloc(pool->aArray, sizeof(wStream*) * pool->aCapacity);
}
else if ((pool->aSize + 1) * 3 < pool->aCapacity)
{
pool->aCapacity /= 2;
pool->aArray = (wStream**) realloc(pool->aArray, sizeof(wStream*) * pool->aCapacity);
}
pool->aArray[(pool->aSize)++] = s;
StreamPool_RemoveUsed(pool, s);