From 5764ab5359cac2bd82199c12e99179a0a6143f3c Mon Sep 17 00:00:00 2001 From: yellowhatter <104833606+yellowhatter@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:48:21 +0300 Subject: [PATCH] Fix GarbageCollect policy for corner cases (#1696) * Fix GarbageCollect policy for corner cases * oops --- commons/zenoh-shm/src/api/provider/shm_provider.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons/zenoh-shm/src/api/provider/shm_provider.rs b/commons/zenoh-shm/src/api/provider/shm_provider.rs index 5a3af8eb9e..c517529df0 100644 --- a/commons/zenoh-shm/src/api/provider/shm_provider.rs +++ b/commons/zenoh-shm/src/api/provider/shm_provider.rs @@ -320,7 +320,7 @@ where provider: &ShmProvider, ) -> ChunkAllocResult { let result = InnerPolicy::alloc(layout, provider); - if let Err(ZAllocError::OutOfMemory) = result { + if result.is_err() { // try to alloc again only if GC managed to reclaim big enough chunk if provider.garbage_collect() >= layout.size().get() { return AltPolicy::alloc(layout, provider);