I'm working on a WPF application, I have a method let's call it **GetUIElement()**, my method returns a **CustomUserControl**, and I have a for loop in which I call **GetUIElement**, the problem is when I have 1000 iterations in the for loop my application consumes too much memory.

PS : 

* Even when I change **GetUIElement()** signature to return a simple Button, I can see the memory growing
* In the constructor and the destructor of **CustomUserControl** I put some debug code to get an idea about the life cycle of my objects, and I saw that they are all destroyed at the same time after the loop, wich explain why my application consumes too much memory, they are all kept in memory until the end of the loop.
I hope I was clear, dont hesitate to tell me if you want more explanation.
and here is some portions of the code :

```
foreach (var item in Data)
{
var element = GetUIElement(item);

//...
}

public FrameworkElement GetUIElement()
{
    CustomUserControl control = new CustomUserControl();
    control.StartButton.Style = Application.Current.Resources["StandardButton"] as Style;
    return control;
}

```