0

I'm developing some windows and pages on an application using .net 4.0 and i'm using AvalonDock version 2.0. I've noticed when users are running this app, and analyzing all log data, all windows previously opened, they're not being destructed. So, i've removed almost all of User Controls and basic Controls from a window (on pages they're being destructed just fine), and I realized that only with AvalonDock on those windows aren't actually destroyed. How can I do to get around this?

Just to clarify the question, I left the window clean (no objects), the destructor is executed. I left with some components and still runs. With AvalonDock, not.

Gustavo Gonçalves
  • 528
  • 1
  • 12
  • 33
  • There's no destructor in C#, it's an implicit call to Finalize. And there is no guarantee on the moment Finalize will be called. – Pierre-Luc Pineault Sep 18 '13 at 18:48
  • @Pierre-LucPineault - the C# specs call `~Classname(){}` a destructor (aka Finalizer). – H H Sep 18 '13 at 19:00
  • @Pierre-LucPineault even so the garbage collector should be able to pick up objects that are free to be released from memory. What I noticed is that the Avalon Dock blocks this operation. – Gustavo Gonçalves Sep 18 '13 at 19:04
  • @GustavoGonçalves But you don't know when the GC will collect them, unless you force it. It can be right now, in a minute, in 10 hours, who knows. And you don't seem to be calling gc.collect yourself. – Pierre-Luc Pineault Sep 18 '13 at 19:09
  • @HenkHolterman Bah you can call it "destructor", but it's important to really make the distinction between that syntactic sugar and a C/C++ "real" destructor. – Pierre-Luc Pineault Sep 18 '13 at 19:18
  • @GustavoGonçalves - "being destructed" is through the destructor or by Dispose() ? Can your logs tell you? – H H Sep 18 '13 at 19:20
  • @HenkHolterman yes, my logs are written exactly when those windows are destructed. – Gustavo Gonçalves Sep 18 '13 at 19:31
  • @Pierre-LucPineault yes, you're right, but that's what i'm confused... Why even in a week with this application running, after 3 or 4 windows being closed, Garbage Collector still doesn't release these objects from memory with Avalon Dock? Without it, it spends only 10 seconds to a minute... That's what i think its strange... Edit 1: in a week without shutting down the application/pc. – Gustavo Gonçalves Sep 18 '13 at 19:33
  • @GustavoGonçalves - you didn't answer my question. – H H Sep 18 '13 at 20:44
  • @HenkHolterman sorry. It is by the destructor. I've put some logs to record when it's destroyed and i'm debugging using breakpoints. – Gustavo Gonçalves Sep 18 '13 at 21:01
  • The destructor is normally not called at all so I suspect you're mis-naming things. – H H Sep 18 '13 at 21:06
  • @HenkHolterman, destructor is always called (as this document from Microsoft -> http://msdn.microsoft.com/en-us/library/66x5fx1b.aspx , Please see examples). And when I remove Avalon Dock from window is normally executed. Also, when i put AvalonDock in a Page, and close that page, destructor is executed just fine. So, my problem is AvalonDock with Window . Don't know why, but it blocks the destructor to run and it's accumulating garbage in memory. – Gustavo Gonçalves Sep 19 '13 at 14:31
  • Most classes call [SuppressFinalize](http://msdn.microsoft.com/en-us/library/system.gc.suppressfinalize.aspx) from `Dispose()`. But you ask the question, document it. Post the logging code and actual symptoms. – H H Sep 19 '13 at 14:53

0 Answers0