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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:06:45+00:00 2026-05-12T14:06:45+00:00

I have a C++ program (GCC) and when I add one or more int

  • 0

I have a C++ program (GCC) and when I add one or more int members to an abstract base class, the program starts crashing. In the case I’ve examined, it seems that by adding this member, a member in a derived class quits getting initialized (or gets stomped on at some point). If I add more members, it starts (not) working different. This is all really odd because the member is never used anywhere. I can comment out that one line and the program recompile just fine and runs without error.

The whole program is ~3KLOC and would be very hard to strip down.

I’m totally at a loss as to where to start looking. Any Ideas?


Update

I found the issue: free-ing malloc-ed memory and delete-ing new-ed memory is not safe in the same program.

  • 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-12T14:06:45+00:00Added an answer on May 12, 2026 at 2:06 pm

    Off the top of my head, without seeing any code (see comments on your question) I would suggest a rogue pointer which normally stomps on something you don’t notice, but introducing a new member makes it stomp on something you do notice.

    Try adding members of different sizes, or more (unused) int members, or maybe a string in the form: const char xxx[50]; to reserve more space.

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

Sidebar

Related Questions

Hi I have the following program. When I compile on the terminal gcc main.c
Visual Studio C++ 2008 / GCC 4.4.2 I have written a program to run
I have a program that only allows one instance of itself to run. I
I have a program that looks something like this: public partial class It {
I have a small program that I can compile with GCC and ICC without
I have successfully compiled a C-program by GCC on Mac with GD2 library installed
I have the following program: ~/test> cat test.cc int main() { int i =
I have a program that does not build with modern GCC with the foollowing
I have written a simple C program using gcc compiler in Ubuntu enviroment. The
gcc 4.4.4 c89 I have a program that I am testing. I create a

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.