diff --git a/src/utils/memory.c b/src/utils/memory.c index 8784759..579d5a2 100644 --- a/src/utils/memory.c +++ b/src/utils/memory.c @@ -1,5 +1,26 @@ /** - * \file + * \file This holds all stufff related our memory managent. + * I try the best as far as I can to reduce memory fragmentation + * and unneccessary calls to alloc and free. + * + * To achive this I try an approach described here as "Quick Fit". + * http://www.flounder.com/memory_allocation.htm + * + * The basic idea is to keep allocated memory segments and don't free + * them again. Instead I will put them in a tree indexed by their size. + * To get new memory I first have a look in the tree if there is + * a fitting memory segment. Fitting mean, larger or exactly the size + * I need. If there is one, use it. If not create a new one using + * usual malloc approach. + * I won't split the reagions at all because most likely they will be + * free soon again. This way I might waste some memory, so I have to + * keep an eye on this. + * + * Right now I don't build an upper limit for allocation. The limit + * still is the system memory itself. + * + * This is not implemented as a class because it will be used in the + * process of object creation. * * \author Georg Hopp *