From 1b96f7af0d233a587d00c32cd7fbd2d8c98deae9 Mon Sep 17 00:00:00 2001 From: John Wells Date: Thu, 8 Feb 2024 23:07:12 -0500 Subject: [PATCH] Increase PoolInfo::DEFAULT_RESOURCE_CAPACITY --- CHANGELOG.md | 2 ++ src/pool/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55a16e3..c6da759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed - Expanded the number of functions and scopes profiled by the `profiling` crate +- Increase `PoolInfo::DEFAULT_RESOURCE_CAPACITY` from 4 to 16 in order to prevent excess resource + creation ## [0.9.4] - 2024-02-07 diff --git a/src/pool/mod.rs b/src/pool/mod.rs index 2b3b6e6..813c0c8 100644 --- a/src/pool/mod.rs +++ b/src/pool/mod.rs @@ -154,7 +154,7 @@ impl Drop for Lease { if let Some(cache) = self.cache_ref.upgrade() { let mut cache = cache.lock(); - if cache.len() >= cache.capacity() { + if cache.len() == cache.capacity() { cache.pop_front(); } @@ -237,7 +237,7 @@ pub struct PoolInfo { impl PoolInfo { /// The maximum size of a single bucket of resource instances. - pub const DEFAULT_RESOURCE_CAPACITY: usize = 4; + pub const DEFAULT_RESOURCE_CAPACITY: usize = 16; /// Constructs a new `PoolInfo` with the given acceleration structure, buffer and image resource /// capacity for any single bucket.