From 6d386c53e1d6124a8132a8126fb0e89e7111ccb6 Mon Sep 17 00:00:00 2001 From: Adam Olsen Date: Tue, 28 Aug 2001 15:55:21 +0000 Subject: [PATCH] My ideas for we could do Qmalloc and reworking Cache_*. --- doc/ideas/memory.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 doc/ideas/memory.txt diff --git a/doc/ideas/memory.txt b/doc/ideas/memory.txt new file mode 100644 index 000000000..2a7c77c49 --- /dev/null +++ b/doc/ideas/memory.txt @@ -0,0 +1,26 @@ +Qmalloc/Qfree/Qrealloc implimentation +- hybrid, has seperate handling for large and small items +- blocks allocated via mmap +- block size is configurable, probably between 1 and 8 megs +- handle small and large items differently, either using an exact + cutoff size, or half/a third of the block size +- large items get their own block, possibly cached +- small items allocated using a first-fit coalescing algorythm (?) +- callback for when allocation not enough memory is available, return + NULL if callback returns false, trying again if it returns true. + +I'm not sure about how distinct small and large items should be, or +when blocks should be unmapped. + +Cache_Alloc/Cache_Free, Cache_Lock/Cache_Unlock +- opaque cache_user_t used to store pointers to the cache data +- cache data may be move or removed +- Cache_Lock prevents data from being move or removed, Cache_Unlock + allows it again. +- Cache_Lock can be called multiple times, Cache_Unlock must be called + an equal number of times to unlock it +- Has a function to attempt to free up space, usable in a callback for + Qmalloc, such that Qmalloc can succeed +- it may use Qmalloc as a backend, or it may use mmap on it's own. + I'm undecided. +