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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:28:44+00:00 2026-06-07T09:28:44+00:00

Running Valgrind against an existing codebase, I am getting a lot of Mismatched free

  • 0

Running Valgrind against an existing codebase, I am getting a lot of “Mismatched free / delete/ delete[]” errors. Many of them are a repeat of one problem: it claims that at line XXX a delete operation is being used, whereas at line YYY a malloc operation is used. However, when I open the file that it complains about and navigate to the line numbers indicated, I find that the memory was not allocated with malloc but with new. The allocated object was an standard ifstream and neither new[] nor delete[] are being used.

I’m running Valgrind 3.5. Does anyone have any idea what is happening? I cannot see how this can be a real error, but I’ve seen some people claim that Valgrind doesn’t turn up many false positives, so I want to have some confidence that this is fake before suppressing it.

  • 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-07T09:28:46+00:00Added an answer on June 7, 2026 at 9:28 am

    You don’t provide a sample program, so this is a crystal-ball guess.

    Your program provides an operator new but is missing an operator delete. The following sample program produces the same error message you are seeing:

    #include <new>
    #include <cstdlib>
    
    /*
     * Sample program that provides `operator new`, but not `operator delete`.
     */
    
    // minimal version of new for demonstration purpose only
    void* operator new(size_t numBytes) {
      return malloc(numBytes);
    }
    
    int main () {
      int *p = new int;
      delete p;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running Valgrind and I'm getting the following error (this is not the only
When I was running my program against valgrind, I encountered the following warning. Warning:
When running Valgrind's memcheck tool, I often get many hundreds of thousands (or more,
After running Valgrind, the resultant log file contains a number of errors that look
I've recently been running one of my apps through Valgrind but there's a few
I'm running valgrind and I'm getting the following error.. before I made a backup
I am running valgrind as follows:- /usr/local/bin/valgrind process_name After excecution its giving me following
I want to check a long running process for memory leaks with valgrind. I
I am trying to use Valgrind on FreeBSD and running into some issues. Here
I am getting the infamous malloc.c:3074 error when running my code (compiles without issue).

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.