diff options
author | lloyd <[email protected]> | 2007-10-21 22:17:48 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-10-21 22:17:48 +0000 |
commit | e925d0a03597cc2504e508b7e11d14fb9bf80721 (patch) | |
tree | 7a054bd6a6bc0a3addef5d6d93b664cf66f1f2ec /include | |
parent | 42fc48730b1e6d320ca64f41e0a6ff3d49395333 (diff) |
Have Malloc_Allocator directly inherit from the Allocator interface, without
using the infrastructure in Pooling_Allocator.
Using malloc directly is slightly faster than using Botan's memory pools
(using the glibc implementation). It may also reduce internal fragmentation,
since the current Pooling_Allocator design is rather suboptimal in that
regard.
Diffstat (limited to 'include')
-rw-r--r-- | include/defalloc.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/defalloc.h b/include/defalloc.h index 184378d84..afdb95edd 100644 --- a/include/defalloc.h +++ b/include/defalloc.h @@ -13,14 +13,15 @@ namespace Botan { /************************************************* * Malloc Allocator * *************************************************/ -class Malloc_Allocator : public Pooling_Allocator +class Malloc_Allocator : public Allocator { public: - Malloc_Allocator() : Pooling_Allocator(64*1024, false) {} + void* allocate(u32bit); + void deallocate(void*, u32bit); + std::string type() const { return "malloc"; } - private: - void* alloc_block(u32bit); - void dealloc_block(void*, u32bit); + + Malloc_Allocator(); }; /************************************************* |