[libc-commits] [libc] [libc] Cache old slabs when allocating GPU memory (PR #151866)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Sun Aug 3 07:33:11 PDT 2025
================
@@ -39,6 +40,9 @@ constexpr static uint32_t MIN_ALIGNMENT = MIN_SIZE - 1;
// The number of times to attempt claiming an in-progress slab allocation.
constexpr static uint32_t MAX_TRIES = 1024;
+// The number of previously allocated slabs we will keep in memory.
+constexpr static uint32_t CACHED_SLABS = 32;
----------------
jhuber6 wrote:
Right now this will use at most 64 MiB that becomes 'reserved' for the `malloc` implementation. It's a little high, but it'll only get that high if the user is *really* using `malloc`, so I think it's warranted.
https://github.com/llvm/llvm-project/pull/151866
More information about the libc-commits
mailing list