Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:36:05+00:00 2026-06-13T16:36:05+00:00

I’m writing an application where after a user uses it – he can ‘reset’

  • 0

I’m writing an application where after a user uses it – he can ‘reset’ it and use it again. The actual use creates some objects including Controls.

I checked the memory usage using Process Explorer and discovered that when the app is used – there’s a rise in memory-use, but when the app is ‘reset’ – the memory-use hardly goes down.

So at the ‘reset’ I Dispose of all of the Controls recursively, and even added a GC.Collect(); to boot. But Process Explorer -> (app's-) Properties -> .Net CLR Memory still shows lots of stuff on the heaps and lots of memory used.

Is this (necessarily) a memory leak? And how come the forced GC doesn’t help?

EDIT:

I added the GC.Collect(); just for debugging – for determining if there is a leak. I’m not worried about a ‘temporary leak’ until the GC works, I’m just trying to find if there are objects that never go out of scope (though I haven’t found them yet) or if it’s just a matter of time, and the memory will be reclaimed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:36:07+00:00Added an answer on June 13, 2026 at 4:36 pm

    Is this (necessarily) a memory leak?

    Well… yes and no. It’s for the most part impossible to have a true memory leak in a C# app, and even the types which utilize native resources under the hood will clean up after themselves in their finalizer if Dispose() was never called.

    Regardless though, it is possible to have stale references and native resources which take too long to clean up (or poorly written native functions which leak themselves), which has the same practical result as a true memory leak would in an unmanaged language.

    And how come the forced GC doesn’t help?

    You gave the GC a suggestion and it chose not to take it. GC.Collect() doesn’t force the GC to clean up everything and the documentation tells you as much. Secondly, is this memory usage actually causing a problem? How much memory is being consumed? Does it ever get freed? If it is just a small amount then you’re probably worrying about nothing, let the GC do its job.

    Without seeing your code all I can do is to guess. There are a couple of ways in which memory pressure can build up in a C# app.

    1. Stale references. Lists of references to "dead" objects that you never clear. Event handlers can cause this as well. For example, a static event should always be unsubscribed to because the event delegate holds a reference to the subscriber.

      So, if the subscriber goes out of scope without unsubscribing to the event you essentially have a memory leak because there is always a valid reference to these "dead" objects. Note that the typical use case for events does not cause this to occur because the parent (event publisher) typically goes out of scope when you need it to.

    2. Not disposing of objects which implement IDisposable. Sure, they probably clean up after themselves in their finalizer (all .NET IDisposable types do and the rest should), but finalizers run at indeterminate times, making the whole thing unpredictable. Make sure to call Dispose() (use a using statement when possible) asap.

    3. Large object heap fragmentation. If you are allocating a lot of "large" objects (objects that are > 85,000 bytes) then it is possible for this segment of memory to become fragmented. This memory is not cleaned up as often as 0th and 1st gen objects allocated on the standard heap are.

    The .NET GC is complicated and usually very good at its job. Sometimes it is acceptable to call GC.Collect, but you should understand when it is a good idea and also realize that it may or may not do what you want it to. For example, if you create a large amount of short lived objects.

    I have had good experiences using RedGate’s .NET memory profiler when I had exhausted other avenues. I don’t work for them nor am I affiliated with them in any way just so you know, and they also have a free trial. Worth a look.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.