#include <iostream>
#include <string>
#include <deque>
using namespace std;

#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>

struct myStruct
{
int i;
string str;
};

int main()
{
deque <myStruct*> mine;
_crtBreakAlloc=-1;

myStruct* s;
for (int i =0 ; i < 10 ; i ++)
{
s = new myStruct;
s->i = i;
s->str = "hello" +i;

mine.push_back(s);
//delete s;
}

for (int i = 0; i < mine.size() ; i++)
cout << mine[i]->i << endl;

system( "pause" );
}

as you can see its very simple . if i use the "delete s" then it will stop the memory leaks but will also make everything in mine compleatly random .

can anyone help , or give me a link or book name to find how to fix this please