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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:07:42+00:00 2026-05-19T09:07:42+00:00

I haven’t been programming for very long and am new to C/C++. I’ve always

  • 0

I haven’t been programming for very long and am new to C/C++. I’ve always used C# in the past, but I’ve switched to native code to write my first Win32 API application. I started in C but became increasingly maddened by trying to work without classes.

I’ve started porting some of the C to C++. Initially, I had the project setup as VC++ using .NET 4. About 25% of the way through porting, I ran the program in debug mode. I was shocked. According to Task Manager, the program uses more than twice the amount of memory as the C version. I then de-.NETified the project and was even more surprised: using only the STL, my application needed 33% of the memory required for the .NET incarnation. Here are the numbers:

Memory Usage
Complete App in C:……………940kb
25% Port in VC++/.NET4:……2.1MB
25% Port in C++:……………….700kb

If I put the other features of .NET aside, I’m left wondering what the advantage of managed memory is if it trebles the memory footprint. Is it the preemption of leaks? Safer pointers?

Thanks

  • 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-19T09:07:43+00:00Added an answer on May 19, 2026 at 9:07 am

    Some of the memory footprint you are seeing will belong to the .Net Framework’s runtime too.

    Garbage collection helps eliminate a lot of programming overhead such as remembering to dealloc memory or to release objects. I’ve programmed a lot in C, Objective C and C# and I can certainly say that whilst garbage collection doesn’t solve every issue, it does remove a lot of responsibility on me and allows me to concentrate on logic rather than hunting for an exra release instruction.

    I also think that the allocation mechanism for new objects is very fast as it always adds to the end of the memory address rather than having to search for blocks large enough.

    I should say that whilst garbage collection is great, it’s not perfect and has it’s own limitations in .Net, especially when dealing with unmanaged code i.e. not calling dispose can leave memory lingering around until finalization. The collection cycles can also be costly as all activity is suspended for the duration of garbage collection.

    As with any technology, understand the benefits and pitfalls and choose appropriately.

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

Sidebar

Related Questions

No related questions found

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.