Q1 2011 WinForms Memory Leak

7 posts, 0 answers
  1. Ivan
    Ivan avatar
    2 posts
    Member since:
    May 2011

    Posted 09 Jun 2011 Link to this post


    We purchased the licenses for Telerik WinForms components and having memory leaks. I've already read similar threads (performance considerations, increasing execution speed of Telerik assemblies), but it didn't solve my problem. Other then that, we verified the code against the following rules which are best coding practices that DEV teams must follow:
    — objects that implements IDisposable must be disposed;
    — grids must be wrapped with BeginUpdate & EndUpdate methods whenever they are getting changed (same holds true for RadTreeView);
    — no excessive database connections;
    — database connections are wrapped with C# "using" operator;
    — time-consuming operations moved to background processes, which writes Trace/Debug messages when finished;
    — custom themes are built in separate DLL and initialized in new thread which gets closed, when job is done.

    The app itself represents MDI container with RadDock on it (Dock = Fill). All MDI child forms are opened in RadDock's new tab. The default tab is Desktop with a grid and 2 more Tool Windows: Tree View which is used as collapsible menu and Recent Activity at the bottom (in fact, similar control layout as VS2010 or SQL Management Studio). We are using custom Telerik themes, which are compiled into separate DLLs to gain the best performance and they are loaded in background worker process when the app starts.

    Steps to reproduce (see attachments 1-5, in order they presented)
    1. Starting the app (MDI container)
    2. Choosing User List (form with single grid) from Tree View aka menu
    3. User List View is loaded
    4. Closing User List View
    5. PROBLEM: Nevertheless form is disposed and it's not in the RadDock tool/window collection — consumed memory amount remained the same. Looping iterations from 2 to 4, will lead to memory leak (memory amount constantly grows)!

    In addition to that, I would like to point that we're using MVP in WinForms. Base Form and UserControl classes are always disposing inner objects or in terms of MVP — presenters, when Form is getting closed. Here's the Trace log:
    UserListView is initialized.
    UserListView is loaded.
    The thread '<No Name>' (0x2304) has exited with code 0 (0x0).
    UserListView is disposed.

    Finally, in attachment there's a screen from ANTS Memory Profiler. 

    Please advice, how we could solve this problem? We spent some time before writing to support, so please be patient with my insistence.

    Kind regards,

  2. Ivan
    Ivan avatar
    2 posts
    Member since:
    May 2011

    Posted 14 Jun 2011 Link to this post

    Guys, can anyone get back to me please?
  3. Jack
    Jack avatar
    2333 posts

    Posted 15 Jun 2011 Link to this post

    Hello Ivan,

    Thank you for contacting us.

    I can confirm that there was a memory leak in our latest release. We have already addressed it and the fix will be available in our next release - Q2 2011 in July. If this is a show stopper for you, we can prepare an internal build where the issue will be addressed. 

    It is also possible that you have faced another issue and we want to investigate the case further. Could you please send us your application? This will help us to identify the issue and find a proper solution faster. Please note that you have to open a new support ticket in order to be able to attach your files.

    Thank you for your cooperation.

    A bit off topic, in your case you need a quick response from us, please directly open a new support tickets. Support tickets are reviewed and handled according to the license that you have.

    I am looking forward to your reply.
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  4. Khizar Khan
    Khizar Khan avatar
    41 posts
    Member since:
    Jan 2010

    Posted 07 Aug 2011 Link to this post


    We are using custome theme and there is a very big foot print when our app runs and there is a memory leak as well..
    can you please advice how to do the following as suggested in this thread.
    "custom themes are built in separate DLL and initialized in new thread which gets closed, when job is done."
    this will definitely help. thanks.

  5. Peter
    Peter avatar
    1148 posts

    Posted 10 Aug 2011 Link to this post

    Hi Khizar Khan,

    We assume that Ivan refers to this KB Article: http://www.telerik.com/support/kb/winforms/themes/load-theme-components-in-a-separate-thread.aspx

    Hope you find this useful. Let us know if you have further questions.

    Best wishes,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  6. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 05 Mar 2012 Link to this post

    I am experiencing the same problem as Ivan and I'm using Q3 2011. I've modified Dispose method on every form like this:
    protected override void Dispose(bool disposing)
        if (disposing && (components != null))
            foreach (RadControl ctrl in this.Controls)
    and got a slightly less memory leak. ANTS says that RadPropertyValue is increasing and I've noticed that some GDI objects (up to 2) survive each form Dispose. Could you please tell me how to get rid of this leak?
  7. Peter
    Peter avatar
    1148 posts

    Posted 08 Mar 2012 Link to this post

    Hello asimptota,

    Thank you for writing.

    Could you please provide me with a sample project demonstrating this behavior and also exact steps that I need to follow in order to reproduce it on my end?

    Please note that when testing for memory leaks you should call the garbage collector before checking the memory. 


    This is necessary because .NET garbage collector is non-deterministic and you cannot say for sure when and how memory will be released. 

    Regarding the large amount of RadPropertyValue - these are used by our themes, which are static resources and they are loaded only once. When loaded, themes stay in memory until the application is closed.

    The DOM element structure of RadControl is a complex tree with a lot of objects. Some of the objects cannot be released with a single garbage collection request, sometimes they become second or third generation objects. Find more about generations in this article

    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top