Sorry for the bad title, but I'm just curious what exactly a memory leak is respectively how I really can say that I've done some bad things in my program. 

I've run the Memory Leak Test in Visual Studio (\_CrtDumpMemoryLeaks()) and it outputs a huge list of detected leaks (just showing a small portion):

```
{1640} normal block at 0x081C2AB0, 4 bytes long.
 Data: <;   > 3B 00 00 00 
{789} normal block at 0x08B792E8, 12 bytes long.
 Data: <            > 00 00 00 00 00 00 00 00 00 00 00 00 
{788} normal block at 0x027E62D8, 32 bytes long.
 Data: <         L   L  > 20 A8 FE 07 A0 A0 17 08 E4 4C F3 07 D8 4C F3 07 
{787} normal block at 0x027E6328, 32 bytes long.
 Data: <layer03 - Object> 6C 61 79 65 72 30 33 20 2D 20 4F 62 6A 65 63 74 
{786} normal block at 0x08B79748, 8 bytes long.
 Data: <`N      > 60 4E F3 07 00 00 00 00

```

I can't really figure out, what exactly I've done wrong. I've followed the tipps from [another question of mine](https://stackoverflow.com/questions/41813753/am-i-producing-a-memory-leak-c-pointers-new-delete/41828044) and replaced all `new/delete` things with **smart pointers** (or at least I think I did).

The reason I ask is, because I've encountered an increase in my memory size and heap size while running my program and I'm not sure, if it is some serious problem or just some kind of basic behaviour. 

Take my (self written) gui for example:

```
std::shared_ptr<Gui_Button> gui_modal_window_map_saved_button;

```

And I now call it with:

```
gui_modal_window_map_saved_button.reset(new Gui_Button(res_handler, "Select", 20, 345, 70, 40, BUTTON_CONFIRM));

```

which has been told to be memory safe. Now, there's something that I am not really sure about - how do I safely delete the button now? I know, there's nothing like delete with smart pointers, but I think of deleting in the way of removing the button when it is not needed any longer, i.e. after the corresponding window has been closed. 

At the moment I'm "deleting" my button with `reset()` 

```
if (g_ev.event_id == EVENT_CLICKED && g_ev.element == gui_modal_window_map_saved_button.get()) {
        gui_modal_window_map_saved.reset();
        gui_modal_window_map_saved_button.reset();
    }

```

I thought that this was okay, but why is my memory size increasing (and not decreasing again) everytime a "new" button is created?

**Coming back to the original question**

I get these dumps of memory leaks by Visual Studio, but I really can't figure out how to use this information. What exactly causes a memory leak? I'm now using only "normal" pointers where I need to pass something to another class i.e., and replaced all `new/deletes` with smart pointers. I really can't show my code, because it is about 3000 lines so far.. 

So, what exactly causes memory leaks and how doI use the informations provided by VS?