Core Dump in Deleting STL [stlport4] vector

S

simon

I am having problem with an application which core dumps while deleting
a vector
here is the snippet :

Event_Node_t struct defined in the header :

+++++++++++++++++++++++++++++++++++++
struct Event_Node_t
{
int id : 24;
int frame : 3;
unsigned is_first_start : 1;
unsigned disqualified : 1;
unsigned truncated : 1;
Event_t e_type;
int pos, pwm_sep;
// pos is the last base of the codon, numbered starting at 1
double score, pwm_score;
Event_Node_t * frame_pred;
Event_Node_t * best_pred;

Event_Node_t () // default constructor
{ is_first_start = disqualified = truncated = 0; }

void Set_Frame_From_Pos
(void);
};

+++++++++++++++++++++++++++++++++++++++++++++++

In the CC file

static Event_Node_t * Last_Event [6];

//Last_Event initialized

Initialize_Terminal_Events(First_Event, Final_Event, Best_Event,
Last_Event);

//function definition

static void Initialize_Terminal_Events(Event_Node_t & first_event,
Event_Node_t & final_event,
Event_Node_t * best_event [6], Event_Node_t * last_event [6])

// Set up first_event and final_event and make all
// entries in best_event and last_event point to
// first_event .

{
int i;

first_event . e_type = INITIAL;
first_event . pos = 0;
first_event . score = 0.0;
first_event . best_pred = NULL;
first_event . frame_pred = NULL;

for (i = 0; i < 6; i ++)
last_event = best_event = & first_event;

final_event . e_type = TERMINAL;
final_event . frame_pred = NULL;

return;
}


+++++++++++++++++++

A few operations done on the Last_Event

+++++++++++++++++++++

Clear_Events()

Definition :

static void Clear_Events(void)

// Free memory in chains pointed to by Last_Event . Note that
// the initial event is not dynamically allocated (it's the global
// variable First_Event ) so it is not cleared.

1>{
2> Event_Node_t * p, * q;
3> int i;
4> printf("inside clear events \n");
5> for (i = 0; i < 6; i ++)
6> for (p = Last_Event ; p != NULL && p -> e_type !=
INITIAL; p = q) {
7> q = p -> frame_pred;
8> delete p;
9> }
10>
11> return;
}


The program core dump during Last_Event[0] is deleted after a no. of
iterations in the loop at line 6 mentioned above . I Am not sure if
this issue is very much
related to the article posted here :

http://www.core-dump.com.hr/?q=node/129

The program is compiled with Sunpro CC compiler with stlport4 libraries

CC -o ../bin/jimmer3 ../obj/jimmer3.o -library=stlport4 -lm -L ../lib
-lGLMicm -lGLMcommon

The earlier problem was that when compiling the program with native
libCstd , it had a huge performence lag. so i opted to compile it with
stlport4

Kindly help me out on this.

Thanx in advance

Simon
 
T

Thomas Tutone

simon wrote:

I am having problem with an application which core dumps while deleting
a vector

I've reviewed your code, and see no vector.
here is the snippet :
[snipped]

The earlier problem was that when compiling the program with native
libCstd , it had a huge performence lag. so i opted to compile it with
stlport4

What are you using from the Standard Library?

Best regards,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top