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. .NET (Core and Framework)
  4. Garbage Collector don't joke!

Garbage Collector don't joke!

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpvisual-studiocomperformancehelp
6 Posts 4 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.
  • M Offline
    M Offline
    myshketer
    wrote on last edited by
    #1

    Hello! I have a C# Windows Form application (VS 2005) which use some COM object. In the end, after Form close, I recieve error message box : HEADER: .NET BradcastEventWindow.2.0.0.0.1.e6fa8e.0:MyApplication.exe - Application error TEXT: The exception unknown software exception (0x00000005) occured in the application at location 0x7d6210ca Click OK to terminate program. I. I have installed WinDbg, but debugging this application is not available. II. I browse internet for look this error and found that it is Garbage Collector error. III. I started VS and attached to MyApplication.exe and didn't sow that location 0x7d6210ca, of cource many modules loaded, but this address was to big. May be it is addres of virtual memory? So, I think that some COM object don't correctly released or some callback come to released object. May be you have some thinks or ideas?

    C 1 Reply Last reply
    0
    • M myshketer

      Hello! I have a C# Windows Form application (VS 2005) which use some COM object. In the end, after Form close, I recieve error message box : HEADER: .NET BradcastEventWindow.2.0.0.0.1.e6fa8e.0:MyApplication.exe - Application error TEXT: The exception unknown software exception (0x00000005) occured in the application at location 0x7d6210ca Click OK to terminate program. I. I have installed WinDbg, but debugging this application is not available. II. I browse internet for look this error and found that it is Garbage Collector error. III. I started VS and attached to MyApplication.exe and didn't sow that location 0x7d6210ca, of cource many modules loaded, but this address was to big. May be it is addres of virtual memory? So, I think that some COM object don't correctly released or some callback come to released object. May be you have some thinks or ideas?

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Did you dispose of the COM object when you were finished with it?


      -- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website

      M 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Did you dispose of the COM object when you were finished with it?


        -- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website

        M Offline
        M Offline
        myshketer
        wrote on last edited by
        #3

        May be not... Looks like you are right - I call GC.Collect() before return from main() and it is help.

        S 1 Reply Last reply
        0
        • M myshketer

          May be not... Looks like you are right - I call GC.Collect() before return from main() and it is help.

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

          There are better ways to do this other than calling GC.Collect(). Ideally, you should wrap the COM object you are using in a wrapper class that implmenets the IDisposable interface and the Dispose pattern. This wrapper class should have the responsibility of explicitly releasing (freeing) the the COM object when it is disposed.

          Scott.


          —In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]

          V 1 Reply Last reply
          0
          • S Scott Dorman

            There are better ways to do this other than calling GC.Collect(). Ideally, you should wrap the COM object you are using in a wrapper class that implmenets the IDisposable interface and the Dispose pattern. This wrapper class should have the responsibility of explicitly releasing (freeing) the the COM object when it is disposed.

            Scott.


            —In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]

            V Offline
            V Offline
            Vaibhav Sharma
            wrote on last edited by
            #5

            I strongly agree with the IDisposable method of disposal then the GC.Collect() as it may just about bring down the performance a bit more. Thanks for displaying both the methods. :)

            Regards, Vaibhav Sharma

            M 1 Reply Last reply
            0
            • V Vaibhav Sharma

              I strongly agree with the IDisposable method of disposal then the GC.Collect() as it may just about bring down the performance a bit more. Thanks for displaying both the methods. :)

              Regards, Vaibhav Sharma

              M Offline
              M Offline
              myshketer
              wrote on last edited by
              #6

              I use class wrapper with Marshal.ReleaseComObject in destructor, but error strangely unpredictable occured in the finish of application.

              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