Hello experts!!
I have written a small program that I hope will run out of memory(just for
testing) because i have deliberately removed the delete of the allocated
memory but it will not run out of memory.
So my question is can you see why not this program will run out of memory.
It consist of three files these are start.cpp,test.h and slask.h
// Here is the file containing the main funtion called start.cpp
#include "test.h"
main()
{
Test testobj;
for (long i =0; i<999999999; i++)
testobj.foo();
}
//Here is file test.h containing the class definition of class Test
#include "slask.h"
class Test
{
public:
void foo()
{ s = new Slask(); }
private:
Slask* s;
};
//Here is the last file named slask.h containg the class definition of class
Slask.
class Slask
{
public:
private:
char namn1[1000];
char namn2[1000];
};
Many thanks
//Tony