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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:09:20+00:00 2026-06-11T02:09:20+00:00

I have been looking through and playing with different features of C++11, specifically in

  • 0

I have been looking through and playing with different features of C++11, specifically in Visual Studio 2010.

One of the things mentioned is minimal garbage collection:

According to this blog post, VC10 supports this feature.

My tests show that the destructor is not called on objects that are lost, so I am not sure as to whether their memory location has been freed or if they are leaking.

I have no intention of depending on it, by any means, but couldn’t find a straight, definitive answer on its behavior.

  • 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-06-11T02:09:22+00:00Added an answer on June 11, 2026 at 2:09 am

    Minimal GC support (n2670) only means functions like std::declare_reachable are included, and define what is the meaning of a “safely-derived pointer”, so making certain operations like XOR-ing pointer values becomes undefined behavior and the GC don’t need to worry about it. See also Bjarne Stroustrup’s C++11 FAQ on the GC ABI, and n2585: Minimal Support for Garbage
    Collection and Reachability-Based Leak Detection
    .

    The proposal allows a GC to be implemented within C++11’s framework. But the proposal itself does not mean the implementation needs to support GC. Some library e.g. libc++ simply implement the library functions as no-op.

    I’m pretty sure, at this point, the memory in your case is just leaked away. But notice that the destructor is indeed not required to run when GC happens. Assuming “§3.8 Object lifetime” also supplies to GC-ed pointers, we have (§3.8/4):

    … For an object of a class type with a non-trivial destructor, the program is not required to call the destructor explicitly before the storage which the object occupies is reused or released; however, if there is no explicit call to the destructor or if a delete-expression (5.3.5) is not used to release the storage, the destructor shall not be implicitly called and any program that depends on the side effects produced by the destructor has undefined behavior.

    So it is also possible the memory is already freed without the destructor called. In fact, earlier GC proposals such as n2310: Transparent Programmer-Directed Garbage Collection for C++ explicitly states that (n2310 §7)

    When an object is recycled by the garbage collector, its destructor is not invoked (Of
    course, explicit deletion always invokes destructors).

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

Sidebar

Related Questions

I have been looking through the Java Tutorials at the Interfaces tutorial, specifically on
i have been looking through the different questions as to how to remove spaces
I have been looking at and playing with OWL through Protege and I would
This one is a tricky one I have been looking through the event viewer
I have been looking through the source code for the Flash-based Google TV example
I have been looking through code for the last 3 days, and the original
I have been looking through some code on an open source project recently and
I am interested in using a DataObject and have been looking through the documentation.
OK, I have been looking for weeks now. I have looked through Eclipse and
I have been trying to find a good-looking design using Aero in Delphi 2010.

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.