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 7434543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:51:20+00:00 2026-05-29T09:51:20+00:00

Do not unsubscribe from COMObject events can cause memory leak although I use Marshal.FinalReleaseComObject?

  • 0

Do not unsubscribe from COMObject events can cause memory leak although I use Marshal.FinalReleaseComObject?

I have defined new member in my class that is COMObject

protected COMObject.Call call_ = null;

This class has the following event handlers that I subscribed to

call_.ActionA += new COMObject.AEventHandler(AEvent);
call_.ActionB += new COMObject.BEventHandler(BEvent);
call_.Destructed += new COMObject.DestructedEventHandler(CallDestructedEvent);

When the Destructed event is called I do Marshal.FinalReleaseComObject

Marshal.FinalReleaseComObject(call_) 

but not unsubscribe from the events

call_.ActionA -= new COMObject.AEventHandler(AEvent);
call_.ActionB -= new COMObject.BEventHandler(BEvent);
call_.Destructed -= new COMObject.DestructedEventHandler(CallDestructedEvent);

Is this can cause memory leak? or that the GC will handle it?
Can you link your answer to some MSDN or article?

Thanks! Dor.

  • 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-05-29T09:51:21+00:00Added an answer on May 29, 2026 at 9:51 am

    Have you tried unsubscribing them before doing the release to see if it helps the memory leak?
    You’ve got a destructed handler, you could do it in there.

    Do you ever call any of the properties of the COM object, and if you do, have you released them properly too?
    I think that even if you call FinalReleaseComObject on the parent object, if you haven’t released the child objects too then even though there are no reference to the parent there may still be references to the children hanging about.

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

Sidebar

Related Questions

I'm not sure what is the best way to unsubscribe from a channel when
I have a class that handles events from a WinForms control. Based on what
I have 3 questions concerning events: Should I always unsubscribe events that were subscribed?
Not very technical, but... I have to implement a bad words filter in a
(Not related to versioning the database schema) Applications that interfaces with databases often have
Not really getting the point of the map function. Can anyone explain with examples
I'm using FtpWebRequest to connect to an FTP server and I can use WebRequestMethods.Ftp.ListDirectoryDetails
If I use durable subscription, can I restart my client and resubscribe without loosing
I have a base class DockedToolWindow : Form, and many classes that derive from
I have this array that store the connection info and i want to use

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.