Allow replacing the object cache with the guarded heap.
This allows to use the debug features of the guarded heap also on allocations made through the object cache API. This is obivously horrible for performance and uses up huge amounts of memory, so the initial and grow sizes are adjusted accordingly. Note that this is a rather simple hack, using the object_cache pointer to transport the allocation size. The alignment is neglected completely.
This commit is contained in:
@@ -13,6 +13,15 @@
|
||||
#include "kernel_debug_config.h"
|
||||
|
||||
|
||||
#if USE_GUARDED_HEAP_FOR_MALLOC && USE_GUARDED_HEAP_FOR_OBJECT_CACHE
|
||||
|
||||
// This requires a lot of up-front memory to boot at all...
|
||||
#define INITIAL_HEAP_SIZE 128 * 1024 * 1024
|
||||
// ... and a lot of reserves to keep running.
|
||||
#define HEAP_GROW_SIZE 128 * 1024 * 1024
|
||||
|
||||
#else // USE_GUARDED_HEAP_FOR_MALLOC && USE_GUARDED_HEAP_FOR_OBJECT_CACHE
|
||||
|
||||
// allocate 16MB initial heap for the kernel
|
||||
#define INITIAL_HEAP_SIZE 16 * 1024 * 1024
|
||||
// grow by another 4MB each time the heap runs out of memory
|
||||
@@ -22,6 +31,8 @@
|
||||
// use areas for allocations bigger than 1MB
|
||||
#define HEAP_AREA_USE_THRESHOLD 1 * 1024 * 1024
|
||||
|
||||
#endif // !(USE_GUARDED_HEAP_FOR_MALLOC && USE_GUARDED_HEAP_FOR_OBJECT_CACHE)
|
||||
|
||||
|
||||
// allocation/deallocation flags for {malloc,free}_etc()
|
||||
#define HEAP_DONT_WAIT_FOR_MEMORY 0x01
|
||||
|
||||
Reference in New Issue
Block a user