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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:05:05+00:00 2026-05-17T16:05:05+00:00

I have the following code #include <iostream> #include <cstddef> #include <string> #include <memory> class

  • 0

I have the following code

#include <iostream>
#include <cstddef>
#include <string>
#include <memory>


class Object
{
public:
       Object()
       {
               std::cout << __PRETTY_FUNCTION__ << std::endl;
       }
       std::string x;

       void *operator new( size_t bytes )
       {
               std::cout << __PRETTY_FUNCTION__ << " : bytes = " << bytes << std::endl;
       }

       void operator delete( void * arg )
       {
               std::cout << __PRETTY_FUNCTION__ << std::endl;
       }
};



int main( int c, char *v[] )
{
       // std::auto_ptr< Object > pObject( new Object() );
       Object *o = new Object();
       delete o;
}

and it produces this output…

static void* Object::operator new(size_t) : bytes = 8

and then core dumps.

Given that I don’t get the output from the operator delete() method and that it core dumps. I’m assuming that my operator delete() method isn’t being invoked.

Can anyone shed any light as to why it isn’t being invoked?

Thank you for focusing on the core dump against my ALL CAPS RANTS because it actually turned out to be the problem.

EDIT–
Ok, Where do I start…. I’m incredibly sorry for ranting. We’ve all been there, under pressure to meet a deadline and something innocuous appears to be causing an issue and we’re convinced it’s one thing when in fact it’s another.
This has taught me a valuable lession… I need to start listening….
I fully appreciate all of help and advice given here.

Thx
Mark.

  • 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-17T16:05:05+00:00Added an answer on May 17, 2026 at 4:05 pm

    You’re crashing well before delete() is called, because you haven’t allocated any storage for std::string x; – if you comment out this instance variable then the code should compile (with warnings) and run OK.

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

Sidebar

Related Questions

i have following code #include <iostream> #include <set> #include <string> using namespace std; template<class
i have following code #include <iostream> #include <string> using namespace std; string generate(){ for
I have the following code: #include <iostream> #include <string> #include <unistd.h> using namespace std;
i have following code for allocation two dimensional array #include <iostream> using namespace std;
I have the following code fragment #include <iostream> #include <ostream> #include <vector> using namespace
I have written the following code #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/filesystem.hpp>
I have the following code that executes a C++ program and outputs it :
I have some code that uses libgmp. At some point the user may request
I have some misunderstanding about the gslice function. Definition from MSDN states: gslice defines
Correction: I messed up with the concept of pointer address and the address the

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.