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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:06:50+00:00 2026-05-15T19:06:50+00:00

I have a managed class that uses a COM that looks like this. Public

  • 0

I have a managed class that uses a COM that looks like this.

Public Class MyClass

    Private myobj as SomeComObject

    Public Sub New()
        myobj = CreateObject("SomeComObject.Class")
    End Sub

    Public Sub DoSomething()
        dim innerobj as SomComObject.InnerClass
        innerobj = myobj.CreateInnerClass("arg1", true, 5)
        innerobj.DoSomething()
    End Sub

End Class

Since I am using an unmanaged dll through a COM-Interob dll I am wondering if I need free the innerobj manually or if the gc is smart enough to do it automagically if I call ReleaseObject()

My class implements IDisposable and I do the following atm:

Runtime.InteropServices.Marshal.ReleaseComObject(myobj)

Do I need to take care of releasing all inner objects that are created by the COM Object or not? And If I do have to do it, does the order matter (first inner then parent vs parent then inner)?

  • 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-15T19:06:51+00:00Added an answer on May 15, 2026 at 7:06 pm

    I’m fairly certain that you should release them all separately. At least when using Office Automation it’s a common reason for things to get stuck in memory when you don’t release all the inner objects which is very easy to do in Office where there are so many collections.

    I’d assume that it would be the same for other COM objects.

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

Sidebar

Related Questions

i have an managed bean(session scope) like this: class Home {// as homeBean public
I have written an Apex class in a Salesforce managed package which uses the
I have an sqlConnection manager class like so: public class SQLConn { public string
I have a class that uses a method from a bean. I'm trying to
I have a list view class that just like NSCollectionView requires an additional prototype
I have an interface IRenderable and a class that manages rendering all instances of
Im making a program for class that manages a Hotel. I have a function
I have created a class that will manage connection and commands, I named it
In my game I have a concept of resource manager, a class that stores
I have a GUI tool that manages state sequences. One component is a class

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.