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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:08:55+00:00 2026-05-16T09:08:55+00:00

I would like to know what are the common memory management issues associated with

  • 0

I would like to know what are the common memory management issues associated with C and C++. How can we debug these errors.

Here are few i know

1)uninitialized variable use

2)delete a pointer two times

3)writing array out of bounds

4)failing to deallocate memory

5)race conditions

1) malloc passed back a NULL pointer. You need to cast this pointer to whatever you want.

2) for string, need to allocate an extra byte for the end character.

3) double pointers.

4) (delete and malloc) and (free and new) don’t go together

5) see what the actual function returns (return code) on failure and free the memory if it fails.
6) check for size allocating memory malloc(func +1)

7) check how u pass the double pointe **ptr to function

8) check for data size for behaviour undefined function call

9) failure of allocation of memory

  • 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-16T09:08:56+00:00Added an answer on May 16, 2026 at 9:08 am

    Preemptively preventing these errors in the first place:

    1) Turn warnings to error levels to overcome the uninitialized errors. Compilers will frequently issue such warnings and by having them accessed as errors you’ll be forced to fix the problem.

    2) Use Smart pointers. You can find a good versions of such things in Boost.

    3) Use vectors or other STL containers. Don’t use arrays unless you’re using one of the Boost variety.

    4) Again, use a container object or smart pointer to handle this issue for you.

    5) Use immutable data structures everywhere you can and place locks around modification points for shared mutable objects.

    Dealing with legacy applications

    1) Same as above.

    2) Use integration tests to see how different components of your application play out. This should find many cases of such errors. Seriously consider having a formal peer review done by another group writing a different segment of the application who would come into contact with your naked pointers.

    3) You can overload the new operator so that it allocates one extra byte before and after an object. These bytes should then be filled with some easily identifiable value such as 0xDEADBEEF. All you then have to do is check the preceeding byte before and after to witness if and when your memory is being corrupted by such errors.

    4) Track your memory usage by running various components of your application many times. If your memory grows, check for missing deallocations.

    5) Good luck. Sorry, but this is one of those things that can work 99.9% of the time and then, boom! The customer complains.

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

Sidebar

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.