I read the following article to get a better understanding of the Stack vs Heap: http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html
How can one manually test their C++ code for memory leaks without using an automated memory leak tool? Since variables on the stack are managed, I assume that a memory leak can only occur when objects are created on the heap.
I apologize. I could only think of two examples. which of the two is better and/or is there a better way to manually observe memory?
Given:
int COUNTERS::NEW_COUNTER = 0;
int COUNTERS::DELETE_COUNTER = 0;
int COUNTERS::CONSTRUCTOR_COUNTER = 0;
int COUNTERS::DESTRUCTOR_COUNTER = 0;
1) Counting Constructor and Destructor counts:
class Example
{
    public:
        Example()
        {
            COUNTERS::CONSTRUCTOR_COUNTER++;
        }
        ~Example()
        {
            COUNTERS::DESTRUCTOR_COUNTER++;
        }
};
2) Counting New and Delete operators:
void myExampleFunction()
{
    Example* e = new Example();
    COUNTERS::NEW_COUNTER++;
    // do stuff with e
    delete e;
    COUNTERS::DELETE_COUNTER++;
}
Thank you.