Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Memory leaks!

Memory leaks!

Scheduled Pinned Locked Moved C#
questiondebuggingperformancehelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Duong Tien Nam
    wrote on last edited by
    #1

    Hi all, I have a complicated form. I call that form from my main form and then close it. After close I call GC.Collect() to ensure that all the memory used for the form has been removed. But it still exited. I load sos.dll and use !dumpheap -stat command to show memory and see that my form and all controls and objects the form use still existed. I debug for a long time, remove delegates, dispose disposable objects etc. but the form didnt' go. So how can I know which object hold reference to the form? (they call them root reference as I remember). Any article, any tool to solve my problems. It's critical, please help me. Regards,

    M S 2 Replies Last reply
    0
    • D Duong Tien Nam

      Hi all, I have a complicated form. I call that form from my main form and then close it. After close I call GC.Collect() to ensure that all the memory used for the form has been removed. But it still exited. I load sos.dll and use !dumpheap -stat command to show memory and see that my form and all controls and objects the form use still existed. I debug for a long time, remove delegates, dispose disposable objects etc. but the form didnt' go. So how can I know which object hold reference to the form? (they call them root reference as I remember). Any article, any tool to solve my problems. It's critical, please help me. Regards,

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello, I work with: http://memprofiler.com/[^]. All the best, Martin

      1 Reply Last reply
      0
      • D Duong Tien Nam

        Hi all, I have a complicated form. I call that form from my main form and then close it. After close I call GC.Collect() to ensure that all the memory used for the form has been removed. But it still exited. I load sos.dll and use !dumpheap -stat command to show memory and see that my form and all controls and objects the form use still existed. I debug for a long time, remove delegates, dispose disposable objects etc. but the form didnt' go. So how can I know which object hold reference to the form? (they call them root reference as I remember). Any article, any tool to solve my problems. It's critical, please help me. Regards,

        S Offline
        S Offline
        Scott Dorman
        wrote on last edited by
        #3

        You can use memprofiler (mentioned in the other post) and you can also use the CLR Profiler[^] tool. You really shouldn't be calling GC.Collect() yourself in any case. All this does is force a garbage collection cycle to run "out of turn", which ultimately causes more work for the GC. Whenever a collection cycle runs, your applications main thread is frozen for the duration of the cycle...so the more times you force a collection, the worse your performance will become. Once you close the form, are you setting the variable reference to null?

        ----------------------------- In just two days, tomorrow will be yesterday.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups