Tuesday, October 23, 2012

Core Dump Resolved

This is a follow up blog to my previous one: Core Dump

As a part of the design, I was passing an element of a second degree vector, for instance, the vector was:

vector < vector < pathDetails > > someName;
I was passing someName[ i ] to function createLightTree. As described in my previous blog, It was repeatedly giving core dumps (std::bad_alloc), so I decided to use a temporary vector for passing values to the function.

So I used another vector

vector < pathDetails > temp
and passed to my function createLightTree, and it worked!!!.

I am still wondering why this happened, as in some of my recent codes, I passed vectors of size 1 GB and it was working fine, the only difference being my distro (last time I used Ububtu and I use Fedora now), but I guess gcc us universally constant with respect to its standards.

Another possible reason could be, the "pass by value concept" the compiler might be copying all of 3-D object to pass on to the designated function.

And at the same time, her ek friend jaroori hota hai, special thanks to my friends who helped me get out of this.

No comments:

Post a Comment