Hi All,

I've got a class that declares an array of pointers like this:

Code:
class RemoraServer : public CommonApplication
{

................

      //these are the hosts this server maintains data for 
      RemoraHost  *host[MAX_HOSTS_PER_SERVER];
      int         numberOfHosts; //ongoing count of how many hosts we're dealing with right now

}; // end class RemoraServer

later in the code, it sets an index of that array to point to an object, thereby instantiating the object, like this:

Code:
            host[numberOfHosts] = new RemoraHost(hostName, hostRef, configFile);

            //we just gained a new host!
            numberOfHosts++;
I'm convinced the instantiation works, since I can interact with the newly created objects.

Now I want to delete all the objects and rebuild them, so I was trying this, but it doesn't work:

Code:
   
   //first destroy all of our current hosts, so we can re-initialize them all
   for (int i = 0; i < numberOfHosts; i++)
   {
      delete host[i];
   } //end for
All of my classes use virtual destructors.
My program SIGSEGV when it tries to delete the host[i], however (according to gdb) it stays within RemoraServer, so I don't think it's a problem with my RemoraHost code.

What am I doing wrong? (more than 1 answer is allowed. ). Thanks for any pointers (pun intended).