I have segmentation fault when calling resize on an stl vector. I'm
unsure if I'm doing something horribly wrong or if the stl is being
dumb. The code breaks down like this:
-------------------------------------
class Device {
public:
Device() {
m_isBusy = false;
m_timeCh = -1.0;
m_timeService = 0.0;
} // Device
~Device() {}
private:
bool m_isBusy;
double m_timeCh;
double m_timeService;
};
class Queue {
public:
Queue() {
m_totalNumber = 0;
m_timeCh = 0.0;
} // Queue
/**** Destructor ****/
~Queue() { clear(); }
clear();
private:
list<TasktheQueue;
double m_timeCh;
int m_totalNumber;
};
void allocate() {
CPUS.resize(NUMBER_OF_CPUS); //type vector<device>
Disks.resize(NUMBER_OF_DISKS); //type vector<device>
diskQueues.resize(NUMBER_OF_DISKS); //type vector<Queue>
}
void clean() {
CPUS.clear();
Disks.clear();
diskQueues.clear();
Event_Queue.clear();
}
-----------------------
Essentially I repeatedly call allocate then clean. On about the 4th
time I call allocate I get the wonderful error message:
Segmentation fault (core dumped)
Any ideas?