Cross-Platform C++

ot::auxil
class MemCheckSystemMonitor

#include "ot/auxil/MemCheckSystemMonitor.h"

ot::SystemMonitor Auxiliary helper class to terminate the OpenTop library cleanly and employ the memory-leak detection facilities of the C runtime library (if any such facilities exist on a given platform) to aid in application memory leak detection. Normally instantiated in the main() function, this class uses its constructor to initialize memory leak detection in the C runtime library.

This class derives from SystemMonitor, so its destructor will facilitate a clean shutdown of the application by calling System::Terminate().

    #include "ot/auxil/MemCheckSystemMonitor.h"
    using namespace ot;
    using namespace ot::auxil;

    int main(int argc, char* argv[])
    {
        // create a MemCheckSystemMonitor instance to ensure clean termination
        // and detect memory leaks on some platforms
        MemCheckSystemMonitor monitor;
        
        // create a deliberate memory leak...
        int* pInt = new int;

        return (0);
    }

Note:
The only compiler currently supplying memory-leak detection within the C-runtime library is Visual C++ under Microsoft Windows. When running a program under the Visual Studio debugger, messages will be produced during program termination to indicate the existence of any detected memory leaks. The MemCheckSystemMonitor class does not currently perform memory-leak detection on any other platforms/compilers.
See also:
SystemMonitor



Constructor/Destructor Summary
MemCheckSystemMonitor()
         Constructor.

Constructor/Destructor Detail

MemCheckSystemMonitor

 MemCheckSystemMonitor()
Constructor. Under some platforms (e.g. Visual C++ under Windows), the constructor initializes the C-runtime library to perform memory-leak detection at application termination.



Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements