/*------------------------------------------------------------------------- | The software accompanies the paper | | | | Classes and Objects of Chemical Thermodynamics in Object-Oriented | | Programming. 2. A Class of Chemical Species | | | | E.B. Rudnyi | | E-mail: rudnyi@comp.chem.msu.su | | Homepages: http://www.chem.msu.su/~rudnyi/welcome.html | | | | presented at Second Electronic Computational Chemistry Conference, | | November 1995, http://hackberry.chem.niu.edu/ECCC2/ | | | | E.B. Rudnyi, Copyright (c) 1995 | | | | Permission to use, copy, modify, distribute and sell this software and | | its documentation for any purpose is hereby granted without fee, | | provided that the above copyright notice with the name of the paper and | | the conference appear in all copies and that both that copyright notice | | and this permission notice appear in supporting documentation. | | E.B. Rudnyi makes no representations about the suitability of this | | software for any purpose. It is provided "as is" without expressed or | | implied warranty. | --------------------------------------------------------------------------*/ // This is a simple class to test the memory management. I peaked the idea up // elsewere, now I don't remember the source. Both functions coreleft() // and heapcheck() are specific to MS-DOS (to Borland compiler?). You may // need to change them. #ifndef _MEMTST_H #define _MEMTST_H #ifndef __IOSTREAM_H #include #endif #ifndef __ALLOC_H #include #endif class memory { public: memory(); ~memory(); void operator()() { cerr << "memory " << coreleft(); if (heapcheck() == _HEAPOK) cerr << ", heap is okay" << endl; else if (heapcheck() == _HEAPCORRUPT) cerr << ", heap is corrupted" << endl; else cerr << ", state of the heap is " << heapcheck() << endl; } }; inline memory::memory() { operator()(); } inline memory::~memory() { cerr << endl; operator()(); } #endif