class memory

This class handles the memory management

Inheritance:


Public Methods

void epilog_on (void)
The function is used to report the final memory releases
void operator delete (void *pointer_to_bytes, size_t size)
The operator is used to build a delete memory management function
void* operator new (size_t size)
The operator is used to build a new memory management function
long status (int id)
Nice function to print out the maximum bytes ever requested

Documentation

This class handles the memory management. The benefit of this class is to keep track of the bytes used. It is therefore an easy way to find memory leaks. This watchdog is only active if the switch MEMCTRL is set at compile time. C++ gives a handy solution with operator overloading. Care should be taken of correct results. The g++ is known as a buggy compiler. The author posted the misbehaviour to the GNU-Foundation.

void* operator new (size_t size)
The operator is used to build a new memory management function. The number of requested bytes is protocoled.

Returns:
Pointer to the memory where to find the amount of requested bytes on success, otherwise NULL
Parameters:
size - how many bytes requested to allocate

void operator delete (void *pointer_to_bytes, size_t size)
The operator is used to build a delete memory management function. The number of released bytes is protocoled. The defined parameters are not used, they are for the correct syntax and therefore syntactic sugar. What doesn't work is to keep track of used bytes allocated in case of arrays. There is no mechanism in C++ to handle such things.

Parameters:
pointer_to_bytes - Pointer to allocated memory
size - how many bytes requested at allocate

void epilog_on(void)
The function is used to report the final memory releases. The last five destructor calls are listed including the remaining bytes which should be released in the near future.

long status(int id)
Nice function to print out the maximum bytes ever requested. Till now there are three different functionalities supported.
    1
    prints out actual number of calls and bytes used, return 0
    2
    prints out maximum number of bytes ever requested, return 0
    3
    no readable output but returns the maximum number of bytes ever requested

Returns:
amount of bytes, kind of bytes depends on id
Parameters:
id - defines what to do


Direct child classes:
sys_message
Author:
Henry Koplien
Version:
1.0 (first release 19. November 1998, last edit 27. November 1998)

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de