From 53d0e27b4f6b38f8446eccbbecdfe91f36773292 Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Thu, 25 Jun 2026 14:39:47 -0500 Subject: [PATCH] stos: ob: Pull object from cache on creation Signed-off-by: Chloe M. --- paw/stos/ob/ob.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/paw/stos/ob/ob.c b/paw/stos/ob/ob.c index 8187481..607cb32 100644 --- a/paw/stos/ob/ob.c +++ b/paw/stos/ob/ob.c @@ -66,14 +66,20 @@ ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Resul return STATUS_NAME_TOO_LONG; } - Object = ExAllocatePoolWithTag( - POOL_NON_PAGED, - sizeof(*Object), - OBJECT_POOL_TAG - ); - + /* + * Try to pull an object from the cache, if there are not + * objects to pull then we'll allocate one. + */ + Object = ObPopFromCache(&gObCache); if (Object == NULL) { - return STATUS_NO_MEMORY; + Object = ExAllocatePoolWithTag( + POOL_NON_PAGED, + sizeof(*Object), + OBJECT_POOL_TAG + ); + + if (Object == NULL) + return STATUS_NO_MEMORY; } RtlMemSet(Object, 0, sizeof(*Object));