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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:38:24+00:00 2026-06-14T15:38:24+00:00

I have an issue with my code that has some very strange symptoms. The

  • 0

I have an issue with my code that has some very strange symptoms.

  1. The code is compiled on my computer with the following versions:

    a. GCC Version: 4.4.2

    b. CMAKE verson: 2.8.7

    c. QNX (operating system) version: 6.5.0

And the code has a segfault whilst freeing some memory and exiting from a function (not dying on any code, just on the exit from a function).

The weird things about this are:

  1. The code does it in release mode but not debug mode:

    a. The code is threaded so this indicates a race condition.

    b. I cannot debug by putting it in debug mode.

  2. The code when compiled on a workmates machine with the same versions of everything, does not have this problem.

    a. The wierd things about this are that the workmates code works, but also that the binary created from compiling on his machine, which is the same, is about 6mB bigger.

Now annoyingly I cannot post the code because it is too big and also for work. But can anyone point me along a path to fixing this.

Since I am using QNX I am limited for my debug tools, I cannot use Valgrind and since it is not supported in QNX, GDB doesn’t really help.

I am looking for anyone who has had a similar/same problem and what the cause was and how they fixed it.

EDIT:

Sooo… I found out what it was, but im still a bit confused about how it happened.

The culprit code was this:

Eigen::VectorXd msBb = data.modelSearcher->getMinimumBoundingBox();

where the definition for getMinimumBoundingBox is this:

Eigen::VectorXd ModelSearcher::getMinimumBoundingBox();

and it returns a VectorXd which is always initialised as VectorXd output(6, 1). So I immediately thought, right it must be because the VectorXd is not being initialised, but changing it to this:

Eigen::VectorXd msBb(6, 1); msBb = data.modelSearcher->getMinimumBoundingBox();

But this didn’t work. In fact I had to fix it by changing the definition of the function to this:

void ModelSearcher::getMinimumBoundingBox(Eigen::MatrixXd& input);

and the call to this

Eigen::VectorXd msBb(6, 1); data.modelSearcher->getMinimumBoundingBox(msBb);

So now the new question:

What the hell? Why didn’t the first change work but the second did, why do I have to pass by reference? Oh and the big question, how the hell didn’t this break when my co-worker compiled it and I ran it? Its a straight out memory error, surely it shouldn’t depend on which computer compiles it, especially since the compiler and all the other important things are the same!!??

Thanks for your help guys.

  • 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-14T15:38:25+00:00Added an answer on June 14, 2026 at 3:38 pm

    … the binary created from compiling on his machine, which is the same, is about 6mB bigger

    It’s worth figuring out what the difference is (even if it’s just the case that his build hides, while yours exposes, a real bug):

    • double-check you’re compiling exactly the same code (no un-committed local changes, no extra headers in the include search path, etc.)
      • triple-check by adding a -E switch to your gcc arguments in cmake, so it will pre-process your files with the same include path as regular compilation; diff the pre-processor output
    • compare output from nm or objdump or whatever you have to for your two linked executables: if some system or 3rd-party library is a different version on one box, it may show up here
    • compare output from ldd if it’s dynamically linked, make sure they’re both getting the same library versions
      • compare the library versions it actually gets at runtime too, if possible. Hopefully you can do one of: run pldd, compare the .so entries in /proc/pid/map, run the process under strace/dtrace/truss and compare the runtime linker activity

    As for the code … if this doesn’t work:

    Eigen::VectorXd ModelSearcher::getMinimumBoundingBox();
    // ...
    Eigen::VectorXd msBb(6, 1); msBb = data.modelSearcher->getMinimumBoundingBox();
    

    and this does:

    void ModelSearcher::getMinimumBoundingBox(Eigen::MatrixXd& input);
    // ...
    Eigen::VectorXd msBb(6, 1); data.modelSearcher->getMinimumBoundingBox(msBb);
    

    you presumably have a problem with the assignment operator. If it does a shallow copy and there is dynamically-allocated memory in the vector, you’ll end up with two vectors holding the same pointer, and they’ll both free/delete it.

    Note that if the operator isn’t defined at all, the default is to do this shallow copy.

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

Sidebar

Related Questions

I have a very weird issue. I have a UserControl that has some controls
So situation is following : We have some very old product, that has dozen
I have a quite strange issue. Please, look at these screenshots: Code of that
I am having a strange issue. I have a very simple piece of code
I have a very specific issue that has to do with an inner class.
Okay, of course it is possible, that's no issue. In my code I have
I have an issue with using the following code in my CakePHP app. In
I have an issue with php where code works on on computer but wont
I have this very strange issue with my MVC 2 project. Often times, I'll
I'm working on some Clojure code that has some circular dependencies between different namespaces

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.