I’m looking for a code that “exhausts” heap_5, I would like to check for performance and speed and memory overhead (allocations and deallocations) in order to evaluate it for my use, I found a few examples online of benchmarks of memory allocators and wrote a simple code, but I was wondering if there’s a reference code for heap_5 specifically.
When I first tried heap_[45].c, I found that they’re extremely fast, and more importantly: they work as they should.
What I did is allocate random blocks of memory of varying sizes, while also freeing allocated blocks in a random order. So now and then, the program would free all allocated blocks.
During all operations, it would check “the number of free bytes”.
I ran it on a fast laptop for couple days. All went as expected.
Often I use heap_5.c because the actual free space is only known at runtime. I put some markers in the linker file, which are turned into pseudo variables in the code: