Click here to Skip to main content
15,901,853 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I get the type of the class I'm in without knowing its name? Pin
Daniel Grunwald19-Feb-10 2:22
Daniel Grunwald19-Feb-10 2:22 
GeneralRe: How do I get the type of the class I'm in without knowing its name? Pin
blackblizzard19-Feb-10 2:35
blackblizzard19-Feb-10 2:35 
QuestionSql Connection Pin
Isaac Gordon18-Feb-10 23:29
Isaac Gordon18-Feb-10 23:29 
AnswerRe: Sql Connection Pin
Eddy Vluggen19-Feb-10 1:05
professionalEddy Vluggen19-Feb-10 1:05 
QuestionGet an "index" for a field of a class? Pin
blackblizzard18-Feb-10 23:29
blackblizzard18-Feb-10 23:29 
AnswerRe: Get an "index" for a field of a class? Pin
Luc Pattyn19-Feb-10 0:21
sitebuilderLuc Pattyn19-Feb-10 0:21 
GeneralRe: Get an "index" for a field of a class? Pin
blackblizzard19-Feb-10 0:30
blackblizzard19-Feb-10 0:30 
QuestionMemory Leak in WPF. Multiple instances of the same control in memory. [modified] Pin
AWriter18-Feb-10 23:03
AWriter18-Feb-10 23:03 
Hello!
I have a problem with some WPF controls.

For example I created a derived from Window tooltip, that will display the .xaml instance of MenuButtons. MenuButtons just simply containts 2 buttons that can be clicked by the user. That's the code :
(menuContentTooltip is a class derived from Window, and that will contain my WPF .xaml MenuButtons control, this menuContentTooltip is a global variable)
if (menuContentTooltip != null)
            {
                menuContentTooltip.Close();
                menuContentTooltip = null;
            }

            MenuButtons menuButtons = new MenuButtons();

            var ttp = new ToolTipParams
            {
                ParentFrameworkEl = menuBtn,
                ChildControlInToolTip = menuButtons,
                Title = "Menu",
                PositionOfToolTip = ToolTipParams.Position.Below
            };
            //------------------------------------------
            menuContentTooltip = new ToolTip(ttp, false, null);
            if (menuContentTooltip.ChildControl != null)
            {
 ((MenuButtons) menuContentTooltip.ChildControl).DemmarerButton.MouseLeftButtonUp += delegate
{                                                                                                             /*Do some work here*/
                                                                                                             if (menuContentTooltip != null)
                                                                                                                 menuContentTooltip.Close();
                                                                                                         };
 ((MenuButtons) menuContentTooltip.ChildControl).GestionButton.MouseLeftButtonUp += delegate
                                                                                                           {
     /*Do some work here*/                                                                                                          if (menuContentTooltip != null)
                                                                                                                   menuContentTooltip.Close();
                                                                                                           };
                menuContentTooltip.ShowToolTipIfNotAuto();
            }

The problem is that everytime when I click the button that executes the code above, the application memory increases without reason, and if I do memory dumping, loading SOS.dll, I see more and more objects of MenuButtons type. For example I clicked and closed the tooltip 3 times, then in visual studio I see this:

!dumpheap -mt 036424f0
Address MT Size
0eabe738 036424f0 264
0ec03568 036424f0 264
0ed03fe0 036424f0 264
total 3 objects
Statistics:
MT Count TotalSize Class Name
036424f0 3 792 MenuButtons
Total 3 objects

!gcroot 0eabe738
Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
Error during command: Warning. Extension is using a callback which Visual Studio does not implement.

Scan Thread 3692 OSTHread e6c
Scan Thread 820 OSTHread 334
Scan Thread 4040 OSTHread fc8
Scan Thread 1804 OSTHread 70c
Scan Thread 2780 OSTHread adc
Scan Thread 3128 OSTHread c38
Scan Thread 3352 OSTHread d18
Scan Thread 2388 OSTHread 954
Scan Thread 3260 OSTHread cbc
Scan Thread 3908 OSTHread f44
Scan Thread 1264 OSTHread 4f0
Scan Thread 2516 OSTHread 9d4
Scan Thread 2760 OSTHread ac8
Scan Thread 2828 OSTHread b0c
Scan Thread 1816 OSTHread 718
Scan Thread 2500 OSTHread 9c4
Scan Thread 3156 OSTHread c54
Scan Thread 1424 OSTHread 590
Scan Thread 2680 OSTHread a78
Scan Thread 2900 OSTHread b54
Scan Thread 4004 OSTHread fa4
Scan Thread 3668 OSTHread e54
Scan Thread 3032 OSTHread bd8
Scan Thread 2536 OSTHread 9e8
Scan Thread 2580 OSTHread a14
Scan Thread 436 OSTHread 1b4
Scan Thread 2040 OSTHread 7f8
Scan Thread 1912 OSTHread 778
Scan Thread 2540 OSTHread 9ec
Scan Thread 1916 OSTHread 77c
DOMAIN(0015DB80):HANDLE(WeakSh):963878:Root:0ebc0514(System.EventHandler)->
0ebc0250(System.Windows.Documents.AdornerLayer)->
0ebc0158(System.Windows.Documents.AdornerDecorator)->
0ebc054c(System.Windows.Controls.ContentPresenter)->
0eb639c4(System.Windows.Controls.Grid)->
0eb63b08(System.Windows.Controls.UIElementCollection)->
0eb63b1c(System.Windows.Media.VisualCollection)->
0eb67a58(System.Object[])->
0eb67948(System.Windows.Controls.Grid)->
0eb67ac4(System.Windows.Controls.UIElementCollection)->
0eb67ad8(System.Windows.Media.VisualCollection)->
0eb67bf8(System.Object[])->
0eb67af0(System.Windows.Controls.StackPanel)->
0eb67ee8(System.Windows.Controls.UIElementCollection)->
0eb67efc(System.Windows.Media.VisualCollection)->
0ebbf5e8(System.Object[])->
0eabe738(MenuButtons)

!gcroot 0ec03568
Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
Error during command: Warning. Extension is using a callback which Visual Studio does not implement.

Scan Thread 3692 OSTHread e6c
Scan Thread 820 OSTHread 334
Scan Thread 4040 OSTHread fc8
Scan Thread 1804 OSTHread 70c
Scan Thread 2780 OSTHread adc
Scan Thread 3128 OSTHread c38
Scan Thread 3352 OSTHread d18
Scan Thread 2388 OSTHread 954
Scan Thread 3260 OSTHread cbc
Scan Thread 3908 OSTHread f44
Scan Thread 1264 OSTHread 4f0
Scan Thread 2516 OSTHread 9d4
Scan Thread 2760 OSTHread ac8
Scan Thread 2828 OSTHread b0c
Scan Thread 1816 OSTHread 718
Scan Thread 2500 OSTHread 9c4
Scan Thread 3156 OSTHread c54
Scan Thread 1424 OSTHread 590
Scan Thread 2680 OSTHread a78
Scan Thread 2900 OSTHread b54
Scan Thread 4004 OSTHread fa4
Scan Thread 3668 OSTHread e54
Scan Thread 3032 OSTHread bd8
Scan Thread 2536 OSTHread 9e8
Scan Thread 2580 OSTHread a14
Scan Thread 436 OSTHread 1b4
Scan Thread 2040 OSTHread 7f8
Scan Thread 1912 OSTHread 778
Scan Thread 2540 OSTHread 9ec
Scan Thread 1916 OSTHread 77c
Scan Thread 3812 OSTHread ee4
Scan Thread 1244 OSTHread 4dc
Scan Thread 2740 OSTHread ab4
Scan Thread 3808 OSTHread ee0
Scan Thread 536 OSTHread 218
Scan Thread 3148 OSTHread c4c
Scan Thread 2908 OSTHread b5c
Scan Thread 3436 OSTHread d6c
Scan Thread 3236 OSTHread ca4
Scan Thread 4044 OSTHread fcc
Scan Thread 3780 OSTHread ec4
Scan Thread 1352 OSTHread 548
Scan Thread 1140 OSTHread 474
Scan Thread 604 OSTHread 25c
DOMAIN(0015DB80):HANDLE(WeakSh):96387c:Root:0ece0858(System.EventHandler)->
0ece0594(System.Windows.Documents.AdornerLayer)->
0ece049c(System.Windows.Documents.AdornerDecorator)->
0ece0890(System.Windows.Controls.ContentPresenter)->
0ec96634(System.Windows.Controls.Grid)->
0ec96778(System.Windows.Controls.UIElementCollection)->
0ec9678c(System.Windows.Media.VisualCollection)->
0ec9a6c8(System.Object[])->
0ec9a5b8(System.Windows.Controls.Grid)->
0ec9a734(System.Windows.Controls.UIElementCollection)->
0ec9a748(System.Windows.Media.VisualCollection)->
0ec9a868(System.Object[])->
0ec9a760(System.Windows.Controls.StackPanel)->
0ec9ab58(System.Windows.Controls.UIElementCollection)->
0ec9ab6c(System.Windows.Media.VisualCollection)->
0ecdffc4(System.Object[])->
0ec03568(MenuButtons)

!gcroot 0ed03fe0
Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
Error during command: Warning. Extension is using a callback which Visual Studio does not implement.

Scan Thread 3692 OSTHread e6c
Scan Thread 820 OSTHread 334
Scan Thread 4040 OSTHread fc8
Scan Thread 1804 OSTHread 70c
Scan Thread 2780 OSTHread adc
Scan Thread 3128 OSTHread c38
Scan Thread 3352 OSTHread d18
Scan Thread 2388 OSTHread 954
Scan Thread 3260 OSTHread cbc
Scan Thread 3908 OSTHread f44
Scan Thread 1264 OSTHread 4f0
Scan Thread 2516 OSTHread 9d4
Scan Thread 2760 OSTHread ac8
Scan Thread 2828 OSTHread b0c
Scan Thread 1816 OSTHread 718
Scan Thread 2500 OSTHread 9c4
Scan Thread 3156 OSTHread c54
Scan Thread 1424 OSTHread 590
Scan Thread 2680 OSTHread a78
Scan Thread 2900 OSTHread b54
Scan Thread 4004 OSTHread fa4
Scan Thread 3668 OSTHread e54
Scan Thread 3032 OSTHread bd8
Scan Thread 2536 OSTHread 9e8
Scan Thread 2580 OSTHread a14
Scan Thread 436 OSTHread 1b4
Scan Thread 2040 OSTHread 7f8
Scan Thread 1912 OSTHread 778
Scan Thread 2540 OSTHread 9ec
Scan Thread 1916 OSTHread 77c
Scan Thread 3812 OSTHread ee4
Scan Thread 1244 OSTHread 4dc
Scan Thread 2740 OSTHread ab4
Scan Thread 3808 OSTHread ee0
Scan Thread 536 OSTHread 218
Scan Thread 3148 OSTHread c4c
Scan Thread 2908 OSTHread b5c
Scan Thread 3436 OSTHread d6c
Scan Thread 3236 OSTHread ca4
Scan Thread 4044 OSTHread fcc
Scan Thread 3780 OSTHread ec4
Scan Thread 1352 OSTHread 548
Scan Thread 1140 OSTHread 474
Scan Thread 604 OSTHread 25c
DOMAIN(0015DB80):HANDLE(Pinned):9613fc:Root:02331010(System.Object[])->
0ed8dbf0(UserControls.ToolTip)->
0ed03fe0(MenuButtons)
DOMAIN(0015DB80):HANDLE(WeakSh):963880:Root:0ede4040(System.EventHandler)->
0ede3d7c(System.Windows.Documents.AdornerLayer)->
0ed8dbf0(UserControls.ToolTip)
DOMAIN(0015DB80):HANDLE(WeakSh):9613fc:Root:02331010(System.Object[])->
0ed8dbf0(UserControls.ToolTip)
DOMAIN(0015DB80):HANDLE(WeakSh):963880:Root:0ede4040(System.EventHandler)->
0ede3d7c(System.Windows.Documents.AdornerLayer)
DOMAIN(0015DB80):HANDLE(WeakSh):9613fc:Root:02331010(System.Object[])->
0ede3d7c(System.Windows.Documents.AdornerLayer)
DOMAIN(0015DB80):HANDLE(WeakSh):963880:Root:0ede4040(System.EventHandler)->
0ede3d7c(System.Windows.Documents.AdornerLayer)
DOMAIN(0015DB80):HANDLE(WeakSh):9613fc:Root:02331010(System.Object[])->
0ede3d7c(System.Windows.Documents.AdornerLayer)
DOMAIN(0015DB80):HANDLE(WeakSh):963880:Root:0ede4040(System.EventHandler)->
0ede3d7c(System.Windows.Documents.AdornerLayer)
DOMAIN(0015DB80):HANDLE(WeakSh):9613fc:Root:02331010(System.Object[])->
0ede3d7c(System.Windows.Documents.AdornerLayer)
DOMAIN(0015DB80):HANDLE(WeakSh):963880:Root:0ede4040(System.EventHandler)->
0ede3d7c(System.Windows.Documents.AdornerLayer)

What's wrong with this code, can someone explain and help me?
Thank's in advance!
modified on Saturday, February 20, 2010 12:18 PM

AnswerRe: Memory Leak in WPF. Multiple instances of the same control in memory. Pin
Saksida Bojan19-Feb-10 20:21
Saksida Bojan19-Feb-10 20:21 
Questiongrid view row copy Pin
Syed Shahid Hussain18-Feb-10 23:01
Syed Shahid Hussain18-Feb-10 23:01 
AnswerRe: grid view row copy Pin
Saksida Bojan19-Feb-10 20:14
Saksida Bojan19-Feb-10 20:14 
QuestionDatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
PoppysDad18-Feb-10 22:48
PoppysDad18-Feb-10 22:48 
AnswerRe: DatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
Vishal Bhatt115-Sep-10 22:58
Vishal Bhatt115-Sep-10 22:58 
AnswerRe: DatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
Zombie_Inc18-Nov-10 20:24
Zombie_Inc18-Nov-10 20:24 
GeneralRe: DatagridViewColumn displayIndex - column order wrong after setting them from control settings table. Pin
henhao8-May-11 7:23
henhao8-May-11 7:23 
QuestionHow to check if Excel-workbook is empty? Pin
Thomas ST18-Feb-10 22:28
Thomas ST18-Feb-10 22:28 
AnswerRe: How to check if Excel-workbook is empty? Pin
Thomas ST18-Feb-10 22:41
Thomas ST18-Feb-10 22:41 
GeneralRe: How to check if Excel-workbook is empty? Pin
Member 766206128-Feb-11 21:40
Member 766206128-Feb-11 21:40 
QuestionTemporary Modification in a Control During Drag and Drop Pin
Som Shekhar18-Feb-10 22:11
Som Shekhar18-Feb-10 22:11 
AnswerRe: Temporary Modification in a Control During Drag and Drop Pin
Luc Pattyn19-Feb-10 0:26
sitebuilderLuc Pattyn19-Feb-10 0:26 
GeneralRe: Temporary Modification in a Control During Drag and Drop Pin
Som Shekhar19-Feb-10 0:35
Som Shekhar19-Feb-10 0:35 
Questionproject using c#.net and sql server 2005 Pin
savitha87k18-Feb-10 20:37
savitha87k18-Feb-10 20:37 
AnswerRe: project using c#.net and sql server 2005 Pin
Saksida Bojan18-Feb-10 20:48
Saksida Bojan18-Feb-10 20:48 
QuestionHow to delete duplicate nodes from XML throgh C# Pin
deadlyabbas18-Feb-10 18:41
deadlyabbas18-Feb-10 18:41 
AnswerRe: How to delete duplicate nodes from XML throgh C# Pin
Saksida Bojan18-Feb-10 20:46
Saksida Bojan18-Feb-10 20:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.