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

  • Home
  • SEARCH
  • 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 6468057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:51:16+00:00 2026-05-25T05:51:16+00:00

In a C++ class with _com_ptr_t members, will memory leak if CreateInstance() is repeatedly

  • 0

In a C++ class with _com_ptr_t members, will memory leak if CreateInstance() is repeatedly used on the same pointer to get fresh instances of COM objects, without first performing a Release()? It’s well documented that ref count is decremented when one of these smart pointers goes out of scope, and that it is not when the encapsulated pointer is Detach()ed. MSDN doesn’t seem to mention the implications of ref counting when repeating CreateInstance().

  • 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-25T05:51:16+00:00Added an answer on May 25, 2026 at 5:51 am

    No leak will occur since _com_ptr_t calls Release() at the beginning of CreateInstance() which you can easily verify yourself by reading _com_ptr_t implementation.

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

Sidebar

Related Questions

When using GWT I get following warning: Referencing deprecated class 'com.google.gwt.user.client.rpc.SerializableException' While it's only
Does anyone know of available Javadoc for Tibco rvd datagrams (specifically, class com.tibco.tibrv.TibrvMsg)? It
Retrieving the COM class factory for component with CLSID {B4E1B2EC-151B-11D2-926A-006008123235} failed due to the
In my GWT app I have the following model class: import com.google.gwt.user.client.rpc.IsSerializable; public class
I have the following interface defined to expose a .NET class to COM: [InterfaceType(ComInterfaceType.InterfaceIsDual)]
I am starting to use MySQL with JDBC. Class.forName(com.mysql.jdbc.Driver); conn = DriverManager.getConnection(jdbc:mysql:///x, x, x);
I want to build a DLL Class Library use COM Interop, with C#, target
I'm trying to to use this class http://robbyonrails.com/articles/2005/05/11/parsing-a-rss-feed but am not sure where to
I'm trying to call Error(My Test) in normal cpp class (Not a COM object,
com/jniwrapper/win32/ie/WebBrowser class not found. From where can I download jniWrapper library. I have downloaded

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.