1

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?

trincot
  • 317,000
  • 35
  • 244
  • 286
kirivasile
  • 21
  • 2

1 Answers1

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