Hello,
I am receiving a segsev from the STL. Using gdb, here is the stack trace at the time of segsev:
Program received signal SIGSEGV, Segmentation fault.
0xfed45d07 in t_splay () from /lib/libc.so.1
(gdb) backtrace
#0 0xfed45d07 in t_splay () from /lib/libc.so.1
#1 0xfed45bd4 in t_delete () from /lib/libc.so.1
#2 0xfed4590e in realfree () from /lib/libc.so.1
#3 0xfed45f17 in cleanfree () from /lib/libc.so.1
#4 0xfed45433 in _malloc_unlocked () from /lib/libc.so.1
#5 0xfed4535c in malloc () from /lib/libc.so.1
#6 0xfef5cd25 in operator new () from /usr/lib/libstdc++.so.6
#7 0x08052b16 in make_next_generation (G=@0x8047acc) at partition.cpp:322
#8 0x08052888 in main () at partition.cpp:289
Here is the offending code:
|
Generation *G1 = new Generation(G->get_Gen_Num());
|
1 2 3 4 5 6 7 8 9 10 11 12 13
|
Generation::Generation(int gen1)
{
gen_Num = gen1;
best_Chromosome = -1; //Defines does not exist yet
for(int i = 0; i < GEN_SIZE; i++)
{
Chromosome * C = new Chromosome();
gen[i] = C;
if (i < ELITISM)
best[i] = C;
}
}
|
And here is the rest of the class information in case that is needed:
1 2 3 4 5 6 7 8 9 10
|
private:
int gen_Num; //Keeps track of the generation number
int best_Chromosome; //This will keep track of the terminating condition.
Chromosome *best[ELITISM]; //Stores the best X amount, where x is the elitism value
/*
*The terminating condition will be number of generations of no improvement to the most fit chromosome.
*Assuming there is no improvement through X number of generations (inversely proportional to the population size,
*but proportional to the NUM_NUMBERS variable), the problem will stop itself.
*/
Chromosome* gen[GEN_SIZE];
|
What is confusing about this to me is that this runs fine until the 42 Generation is completed, and it is on to creating the 43rd generation. It always happens there, no other time. So I am curious as to why it would only happen then, and what is causing this. Any help/ideas would be appreciated.
One thing I do know is that it is not my server I am running on causing it to do this, I have run into that problem, which cuts it off at around 4GB (each process), and this one gets cut off at around 250MB.
I am working on this on the side, as I have recently discovered Genetic Algorithms and decided to play around with it for a while.
Thanks!