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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:52:41+00:00 2026-05-25T12:52:41+00:00

Basically I have a strange problem, I have a struct Node that inherits from

  • 0

Basically I have a strange problem, I have a struct Node that inherits from counter struct. And in the counter struct I have this check to make “sure” that Destructor is called only on allocated memory and that it is called only once.

static atomic < int > check;

counter()
      {
          check=42;
//...
      }

 ~counter() 
    {
        if (check!=42)
        {
            cout<<"ouch"<< typeid(T).name()<<"  "<< check<<"  "<< objects_created<< endl;
            sleep(1);
            assert(0);
        }
        check=84;
     //...
    }

and it breaks when compiled with g++4.6

3  0x00007ffff65ec7a4 in counter<Node>::~counter (this=0x614c60, 
    __in_chrg=<value optimized out>)
    at /home...


4  0x00007ffff65e7a4d in Node::~Node (this=0x614c60, 
    __in_chrg=<value optimized out>)
    at /home...


5  0x00007ffff6603cf2 in std::_Destroy<Node> (__pointer=0x614c60)
    at /usr/include/c++/4.6/bits/stl_construct.h:92


6  0x00007ffff6600004 in std::_Destroy_aux<false>::__destroy<Node*> (
    __first=0x614c60, __last=0x614d40)
    at /usr/include/c++/4.6/bits/stl_construct.h:102


7  0x00007ffff65fa003 in std::_Destroy<Node*> (__first=0x614c60, 
    __last=0x614d40) at /usr/include/c++/4.6/bits/stl_construct.h:125


8  0x00007ffff65f2a4f in std::_Destroy<Node*, Node> (__first=0x614c60, 
    __last=0x614d40) at /usr/include/c++/4.6/bits/stl_construct.h:151


9  0x00007ffff65ecfb2 in std::vector < Node, std::allocator < Node>
>::~vector (
    this=0x7ffff68329f8, __in_chrg= < value optimized out>)
    at /usr/include/c++/4.6/bits/stl_vector.h:348
  • 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-25T12:52:41+00:00Added an answer on May 25, 2026 at 12:52 pm

    check is static, which means that it is shared by all instances of the class. Since you want check to be a normal class member, you should remove the static keyword.

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

Sidebar

Related Questions

I have very strange problem with Doxygen: I used it to create documentation from
I have a bit of a strange problem with MySQL that I've never seen
I have a very strange situation. Basically I have code that uses a decryptor
Well i have a little problem but really strange. So basically i analyzed URL
Well i have a little problem but really strange. So basically i analyzed URL
Very strange, not sure if others have experienced this... Exporting with Flash CS5.5 to
I have a strange problem on orientation handling on Samsung Tablets. Basically, I have
i have a strange problem with sending HTML mail in c#. Basically i am
Okey this is really strange. I have this script which basically downloads bunch of
I basically have something like this: void Foo(Type ty) { var result = serializer.Deserialize<ty>(inputContent);

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.