Flood memory manager // Home

Contents: What is "Flood" Features What else? Requirements Flood license Author

What is "Flood"

Flood is a small dynamic memory manager library which implements new/delete like operations. User application is permitted but is not required to explicitly issue them. All memory management routines can be performed automatically. Flood's distinctive feature is support for transparent memory pool defragmentation. Other attractive properties of it are convenient (I hope) user interface and build-in automatic garbage collector.

Why "Flood"? Although you can invent one, there are no abbreviations or deeply ciphered acronyms. Allocated fragments in Flood's memory pool are free to change their location as if they were particles of quicksand or fluid substance. That's it.

My main goal of this project is to share code. And until there is no feeback I will work on it from time to time, just because I like coding :) Thus questions are wellcome.

Features

Flood's features include

  • It does not require any additional memory allocation support. Current imlementation uses single malloc call at startup and single free at exit. It even can be implemented using sbrk() Unix system call.
  • Garbage collection algorithm (I suppose, not the slowest one) is built-in.
  • Allocation is type safe. Each block holds run time type information (it utilizes C++'s features like dynamic_cast and typeid operator).
  • Pointer operation restrictions imposed by Flood are similar to those in Java (arrays instead of pointer arithmetic). Nonetheless some emulation of pointer arithmetic can be implemented.
  • Flood is not thread-safe.
See Technical overview for details.

What else?

If you need only automatic garbage collection you may look at other existing solutions. One of them is using of smart pointers (Smart Pointer Library). Although they don't handle cyclic graph case they can be useful if your data structures have not cycles.

Memory pool system from Ravenbrook could be another choise. Although I have not used this library it looks as very comprehensive solution for memory management tasks.

Note that automatic garbage collection alone has less painful solutions (in respect of compatibility with existing code). You may wish to look for an example at garbage collectors build in Mozilla, Perl or Python.

Efficient allocation of equal size blocks and other useful C++ utilities are implemented in Boost library.

Requirements

  • OS: Unix (currently it is compiled under Linux but porting should be highly straitforward)
  • Programming language: written completely in C++
  • Inline documentation: formatted for doxygen.
  • No additional libraries required but STL (altough testing application needs standard I/O :-)

Flood license

I have spent few hours choosing an open source license for Flood :) and finally selected GNU LGPL license. I am feel comfortable with it. Whereas there are no other contributions to this project yet, it is possible to change license to less restrictive one (BSD like, for example) in case you really need Flood but can not use it under present license.

Flood library is covered by GNU LGPL license. Flood's testing facility is covered by GNU GPL license.

Author

Petr Gladkikh: batyi at mail ru


(C) Petr Gladkikh, 2002

Хостинг от uCoz