memory defragmentation

2 posts, 0 answers
  1. Andreas Lohr
    Andreas Lohr avatar
    29 posts
    Member since:
    Aug 2009

    Posted 12 Dec 2009 Link to this post


    we have programed a class library, that has too big memory usage. We have disposed explicit all unmanaged resources like files. We have already taken a look with a memory profiler and its seems the problem is that the GC doesnot clear up the memory or the memory gets defragemented (there are a lot of small pieces of memory and .net allocates always new memory instead of reusing the small free pieces of memory). The process goes up to 2 GB RAM usage, but such amount of memory is never used / needed.

    Note: Its a multi-threaded application.

    I am out of ideas, what I can try to get the process smaller. All ideas will be appreciated!

    Thanks in advance !!

    Best regards

  2. Nick
    Nick avatar
    767 posts

    Posted 14 Dec 2009 Link to this post

    Hello Andreas Lohr,

    Thank you for contacting us.

    Tracking down memory issues is not always straightforward, but here are several tips applicable to .net framework in general:

    1) Use the using keyword in C# or the Dispose method when you no longer need resources.
    2) Events are one of the key reasons objects do not get collected by the garbage collection so always unsubscribe objects because they will not be collected otherwise.
    3) If you have the time and resources, you can consider reducing the memory required by your program in general e.g. cleverer algorithms and less caching.

    Do you experience any memory leaks in our controls?

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top