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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:51:30+00:00 2026-05-13T21:51:30+00:00

Additional thanks extend to Daniel Newby for answering my memory usage question (and Martin

  • 0

Additional thanks extend to Daniel Newby for answering my memory usage question (and Martin York for explaining it a bit more). It is definitely the answer I was looking for, but more of my other questions were answered by others.

Thanks everyone

for clearing up all of my concerns. Very pleased to see things running how I expect them to run.

I’ve run into something that I’m not exactly sure about.

In my program, I’m not using malloc() or free(). I’m making instances of my classes with new and I’ve made sure each one runs it’s destructor when it’s delete‘d, however, there are no free() calls or even setting their pointers (to things inside a global scope, or other classes) to NULL or 0.

What I mean by "I’ve made sure", is not that I call each destructor. I only use delete to call on the destructor to run, but I have variables that increase by 1 everytime an object is created, and everytime it’s destructor is run. This is how I’ve made sure the amount of objects I created are equal to the amount of destructors called.

Should I be using malloc() and free() anyway? Should I be NULLing pointers to things that I still want to exist?

A second question is why, when I look at my task manager, does my process never "drop" memory? It used to never stop gaining, and then I started deleting everything properly. Or so I thought.

Wouldn’t free() or delete make the memory usage go down?

What practices should I pursue about malloc‘ing and free‘ing memory with linked lists?

  • 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-13T21:51:30+00:00Added an answer on May 13, 2026 at 9:51 pm

    There’s rarely a reason to use malloc() and free() in a C++ program. Stick with new and delete. Note that unlike languages with garbage collection, setting a pointer to NULL or 0 in C++ has nothing to do with deallocating the memory.

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

Sidebar

Related Questions

I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record
I need to display additional information, like a tooltip, but it's a lot of
how do I pass additional information to the service method returning the collection of
Is there some additional configuration needed before I can set thread priorities in a
are there any additional WPF themes from microsoft except that default ones provided in
I'm storing some additional per-user information using the AUTH_PROFILE_MODULE . We can access the
What is the best approach to define additional data for typedef enums in C?
I'm using jQuery to add an additional row to a table as the last
Given a credit card number and no additional information, what is the best way
How would you manually trigger additional team builds from a team build? For example,

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.