Algorithmic Solutions > LEDA > LEDA Guide > Simple, Basic, and Advanced Data Types > Simple Data Types > Memory Management

Memory Management

LEDA offers an efficient memory management system that is used internally for all node, edge, and item types.

To use the memory management you simply add the macro call "LEDA_MEMORY(T)" to the declaration of a class T. This redefines new and delete operators for type T, such that they allocate and deallocate memory using LEDA's internal memory manager.

Complete example for memory management...

Strengths

  • Memory is allocated in big chunks. This improves the running time by reducing the number of system calls to allocate memory.
  • Memory returned by the delete operator is reused by later calls of the new operator.

Disadvantages

  • Does not release allocated memory until the program terminates.
  • The improvement is not so significant for big classes.

Tips

  • The best results are achieved for small classes
  • Use the system if running time is an issue and the number of objects of your class does not vary too much

Manual Entries:

Manual Page Memory Management

LEDA Item Concept




Please send any suggestions, comments or questions to leda@algorithmic-solutions.com
© Copyright 2001-2003, Algorithmic Solutions Software GmbH