I am writing a project "Threadsafe allocator". Every thread has its own heap, and heap consists of blocks(4 KB). Allocator uses the memory from different blocks. What should I do to avoid fragmetation of data in blocks?
Asked
Active
Viewed 44 times
1 Answers
0
A good start may be to read the "jemalloc" paper.
Basically there's no easy answer to "How to avoid fragmentation". There are a lot of academic papers written on the subject. Read some and it might give you some insight into the problem and possible solutions.

Tom van der Woerdt
- 29,532
- 7
- 72
- 105