BUG#: 6096
authorkumpf <kumpf>
Tue, 13 Feb 2007 18:55:28 +0000 (18:55 +0000)
committerkumpf <kumpf>
Tue, 13 Feb 2007 18:55:28 +0000 (18:55 +0000)
TITLE: Memory leak in StressTestController
DESCRIPTION: Use AutoArrayPtr objects to manage dynamically allocated memory.

test/StressTestController/StressTestController.cpp
test/StressTestController/StressTestController.h
test/StressTestController/StressTestControllerMain.cpp

index aa6c91f02e211597202d3a7e864f168b38b0a68b..755601871459385e03f4c43eccd09fc54006b8a8 100644 (file)
 //
 //==============================================================================
 //
-// Author: John Alex
-//
-// Modified By:
-//
 //%/////////////////////////////////////////////////////////////////////////////
 
 #include <iostream>
@@ -373,19 +369,7 @@ StressTestControllerCommand::StressTestControllerCommand ()
     //
     // Set up tables for client properties.
     //
-    _clientTable = new Table[Total_Clients];
-
-    // 
-    // Allocate one table to collect all the common properties Thy use AutoPtr
-    //
-    _propertyTable = new Table;
-
-    //
-    // Client Information
-    //
-    _clientCommands = 0;
-    _clientDurations = 0;
-    _clientDelays = 0;
+    _clientTable.reset(new Table[Total_Clients]);
 
     //
     // Get environment variables:
@@ -590,7 +574,7 @@ void StressTestControllerCommand::setCommand (Uint32 argc, char* argv [])
                     }
                     _hostName = getOpts [i].Value ();
                     _hostNameSpecified = true;
-                    if (!_propertyTable->insert("hostname", _hostName))
+                    if (!_propertyTable.insert("hostname", _hostName))
                     {
                          // shouldn't get here
                          if(verboseEnabled)
@@ -627,7 +611,7 @@ void StressTestControllerCommand::setCommand (Uint32 argc, char* argv [])
                         throw e;
                     }
                     _portNumberSpecified = true;
-                    if (!_propertyTable->insert("port", _portNumberStr))
+                    if (!_propertyTable.insert("port", _portNumberStr))
                     {
                         if(verboseEnabled)
                         {
@@ -648,7 +632,7 @@ void StressTestControllerCommand::setCommand (Uint32 argc, char* argv [])
                     {
                        _portNumber = 5989;
                        _portNumberStr = "5989";
-                       if (!_propertyTable->insert("port", _portNumberStr))
+                       if (!_propertyTable.insert("port", _portNumberStr))
                        {
                            if(verboseEnabled) 
                            {
@@ -658,7 +642,7 @@ void StressTestControllerCommand::setCommand (Uint32 argc, char* argv [])
                            }
                        }
                     }
-                    if (!_propertyTable->insert("ssl", ""))
+                    if (!_propertyTable.insert("ssl", ""))
                     {
                         if(verboseEnabled)
                         {
@@ -682,7 +666,7 @@ void StressTestControllerCommand::setCommand (Uint32 argc, char* argv [])
                     }
                     _userName = getOpts[i].Value();
                     _userNameSpecified = true;
-                    if (!_propertyTable->insert("username", _userName))
+                    if (!_propertyTable.insert("username", _userName))
                     {
                         if(verboseEnabled)
                         {
@@ -706,7 +690,7 @@ void StressTestControllerCommand::setCommand (Uint32 argc, char* argv [])
                     }
                     _password = getOpts[i].Value();
                     _passwordSpecified = true;
-                    if (!_propertyTable->insert("password", _password))
+                    if (!_propertyTable.insert("password", _password))
                     {
                         if(verboseEnabled)
                         {
@@ -782,9 +766,9 @@ Boolean StressTestControllerCommand::generateClientCommands(ostream& log_file)
     // 
     // Array's to store client specific information
     //
-    _clientCommands = new String[_clientCount]; 
-    _clientDurations = new Uint64[_clientCount];
-    _clientDelays = new Uint64[_clientCount]; 
+    _clientCommands.reset(new String[_clientCount]);
+    _clientDurations.reset(new Uint64[_clientCount]);
+    _clientDelays.reset(new Uint64[_clientCount]);
 
     //
     // Retrieve all the client options from the client table
@@ -799,7 +783,7 @@ Boolean StressTestControllerCommand::generateClientCommands(ostream& log_file)
         // 
         //  Stress Client Name must exist for each client/client table 
         //
-        if (!_clientTable[j].lookup(NAME, clientName))
+        if (!_clientTable.get()[j].lookup(NAME, clientName))
         {
             log_file<<StressTestControllerCommand::COMMAND_NAME<<
                  "::Required property NAME not found."<<endl;
@@ -813,7 +797,7 @@ Boolean StressTestControllerCommand::generateClientCommands(ostream& log_file)
         // 
         // Generate the commands for each client from each client table.
         //
-        for (Table::Iterator i = _clientTable[j].start(); i; i++)
+        for (Table::Iterator i = _clientTable.get()[j].start(); i; i++)
         {
             if (String::equalNoCase(i.key(),HOSTNAME))
             {
@@ -927,14 +911,14 @@ Boolean StressTestControllerCommand::generateClientCommands(ostream& log_file)
         // from config file and include it as part of the client command 
         // as required.
         //
-        for (Table::Iterator k = _propertyTable->start(); k; k++)
+        for (Table::Iterator k = _propertyTable.start(); k; k++)
         {
             String propertyValue = String::EMPTY;
             //
             // Only include the common properties that are not already
             // listed for the clients.
             //
-            if (!_clientTable[j].lookup(k.key(), propertyValue))
+            if (!_clientTable.get()[j].lookup(k.key(), propertyValue))
             {
                 //
                 // Include options other than ToleranceLevel
@@ -969,12 +953,12 @@ Boolean StressTestControllerCommand::generateClientCommands(ostream& log_file)
             {
                 duration = _duration;
             }
-        } /* for (Table::Iterator k = _propertyTable->start(); k; k++) */
+        } /* for (Table::Iterator k = _propertyTable.start(); k; k++) */
 
         //
         // Looking up table while ignoring cases for Client Duration/Wait.
         //
-        for (Table::Iterator k = _clientTable[j].start(); k; k++)
+        for (Table::Iterator k = _clientTable.get()[j].start(); k; k++)
         {
             //
             // Overwrite duration if client duration set
@@ -993,39 +977,37 @@ Boolean StressTestControllerCommand::generateClientCommands(ostream& log_file)
         // Save the generated command to corresponding element in the 
         // clientCommand array.
         //
-        _clientCommands[j] = client_command;
+        _clientCommands.get()[j] = client_command;
 
         //
         // Converting minutes to milliseconds
         //
-        _clientDurations[j] = (Uint64)convertmin2millisecs(duration);
-        _clientDelays[j] = (Uint64)convertmin2millisecs(delay);
+        _clientDurations.get()[j] = (Uint64)convertmin2millisecs(duration);
+        _clientDelays.get()[j] = (Uint64)convertmin2millisecs(delay);
        
         //
         // Saving logs
         //
-        log_file<<StressTestControllerCommand::COMMAND_NAME<<
-            "::Client Command[";
-        log_file<<j<<"]"<<endl;
-        log_file<<"  "<<_clientCommands[j]<<endl;
-        log_file<<"   Client Duration: "<<
-            convertUint64toString(_clientDurations[j])<<endl;
-        log_file<<
-            "   Client Delay: "<<convertUint64toString(_clientDelays[j])<<endl;
+        log_file << StressTestControllerCommand::COMMAND_NAME <<
+            "::Client Command[" << j << "]" << endl;
+        log_file << "  " << _clientCommands.get()[j] << endl;
+        log_file << "   Client Duration: " <<
+            convertUint64toString(_clientDurations.get()[j]) << endl;
+        log_file << "   Client Delay: " <<
+            convertUint64toString(_clientDelays.get()[j]) << endl;
 
         //
         // Verbose 
         //
         if (verboseEnabled)
         {
-            cout<<
-                StressTestControllerCommand::COMMAND_NAME<<"::Client Command[";
-            cout<<j<<"]"<<endl;
-            cout<<"  "<<_clientCommands[j]<<endl;
-            cout<<"   Client Duration: "<<
-                convertUint64toString(_clientDurations[j])<<endl;
-            cout<<"   Client Delay: "<<convertUint64toString(_clientDelays[j])<<
-                endl;
+            cout << StressTestControllerCommand::COMMAND_NAME <<
+                "::Client Command[" << j << "]" << endl;
+            cout << "  " << _clientCommands.get()[j] << endl;
+            cout << "   Client Duration: " <<
+                convertUint64toString(_clientDurations.get()[j]) << endl;
+            cout << "   Client Delay: " <<
+                convertUint64toString(_clientDelays.get()[j]) << endl;
         }
     } /* for(Uint32 j=0; j< _clientCount; j++) */
     return true;
@@ -1058,25 +1040,22 @@ Uint32 StressTestControllerCommand::execute (
     ostream& outPrintWriter,
     ostream& errPrintWriter)
 {
-  
     int actual_client = 0;
     Uint64 startMilliseconds = 0;
     Uint64 nowMilliseconds = 0;
     Uint64 stopMilliseconds = 0;
     Uint64 timeoutMilliseconds = 0;
-    Uint64 *clientStartMilliseconds = 0;
-    Uint64 *clientStopMilliseconds = 0;
-    Uint64 *clientDelayMilliseconds = 0;
-    Boolean *clientStopped = 0;
-    Boolean *clientDelayed = 0;
-    String act_command = String::EMPTY;
+    AutoArrayPtr<Uint64> clientStartMilliseconds;
+    AutoArrayPtr<Uint64> clientStopMilliseconds;
+    AutoArrayPtr<Uint64> clientDelayMilliseconds;
+    AutoArrayPtr<Boolean> clientStopped;
+    AutoArrayPtr<Boolean> clientDelayed;
+    String act_command;
     Boolean TestFailed = false;
     char str[15];
     char strTime[256];
     struct tm tmTime;
 
-
-
     //
     // log file
     //       
@@ -1147,11 +1126,11 @@ Uint32 StressTestControllerCommand::execute (
     if(_clientCount > 0)
     {
         clientInstance = new int[_clientCount]; 
-        clientStartMilliseconds = new Uint64[_clientCount];
-        clientStopMilliseconds  = new Uint64[_clientCount];
-        clientDelayMilliseconds = new Uint64[_clientCount];
-        clientStopped = new Boolean[_clientCount];
-        clientDelayed = new Boolean[_clientCount];
+        clientStartMilliseconds.reset(new Uint64[_clientCount]);
+        clientStopMilliseconds.reset(new Uint64[_clientCount]);
+        clientDelayMilliseconds.reset(new Uint64[_clientCount]);
+        clientStopped.reset(new Boolean[_clientCount]);
+        clientDelayed.reset(new Boolean[_clientCount]);
     } 
     else 
     { 
@@ -1169,8 +1148,8 @@ Uint32 StressTestControllerCommand::execute (
         //
         for (Uint32 i=0;i<_clientCount;i++)
         {
-            clientStopped[i] = false;
-            clientDelayed[i] = false;
+            clientStopped.get()[i] = false;
+            clientDelayed.get()[i] = false;
         }
         //
         // Set up duration of the tests
@@ -1253,7 +1232,7 @@ Uint32 StressTestControllerCommand::execute (
                     //
                     // Acquire the client Instance for each clients
                     //
-                    if (!_clientTable[j].lookup(INSTANCE, clientInst))
+                    if (!_clientTable.get()[j].lookup(INSTANCE, clientInst))
                     {
                         String ErrReport = String("Invalid Property Value: ");
                         ErrReport.append(INSTANCE);
@@ -1266,35 +1245,41 @@ Uint32 StressTestControllerCommand::execute (
                     //
                     // Acquire and set client specific duration
                     //
-                    clientStartMilliseconds[j] = 
+                    clientStartMilliseconds.get()[j] = 
                         TimeValue::getCurrentTime().toMilliseconds();
-                    clientStopMilliseconds[j] = 
-                        clientStartMilliseconds[j] + _clientDurations[j];
+                    clientStopMilliseconds.get()[j] = 
+                        clientStartMilliseconds.get()[j] +
+                            _clientDurations.get()[j];
 
                     // 
                     // for verbose only
                     //
                     if (verboseEnabled)
                     {
-                        outPrintWriter<<"Client:"<<"["<<j<<"]"<<endl;
-                        log_file<<"Client:"<<"["<<j<<"]"<<endl;
-                        outPrintWriter<<"ClientStart:"<<
-                            convertUint64toString(clientStartMilliseconds[j])<<
+                        outPrintWriter << "Client:" << "[" << j<< "]" << endl;
+                        log_file << "Client:" << "[" << j << "]" << endl;
+                        outPrintWriter << "ClientStart:" <<
+                            convertUint64toString(
+                                clientStartMilliseconds.get()[j]) <<
                             endl;
-                        outPrintWriter<<"ClientStop:"<<
-                            convertUint64toString(clientStopMilliseconds[j])<<
+                        outPrintWriter << "ClientStop:" <<
+                            convertUint64toString(
+                                clientStopMilliseconds.get()[j]) <<
                             endl;
-                        outPrintWriter<<"ClientDuration:"<<
-                            convertUint64toString(_clientDurations[j])<<endl;
-                        log_file<<"ClientStart:"<<
-                            convertUint64toString(clientStartMilliseconds[j])<<
+                        outPrintWriter << "ClientDuration:" <<
+                            convertUint64toString(_clientDurations.get()[j]) <<
                             endl;
-                        log_file<<"ClientStop:"<<
-                            convertUint64toString(clientStopMilliseconds[j])<<
+                        log_file << "ClientStart:" <<
+                            convertUint64toString(
+                                clientStartMilliseconds.get()[j]) <<
+                            endl;
+                        log_file << "ClientStop:" <<
+                            convertUint64toString(
+                                clientStopMilliseconds.get()[j]) <<
+                            endl;
+                        log_file << "ClientDuration:" <<
+                            convertUint64toString(_clientDurations.get()[j]) <<
                             endl;
-                        log_file<<
-                            "ClientDuration:"<<
-                            convertUint64toString(_clientDurations[j])<<endl;
                     }
                     log_file<<
                         "Number of instances of this client: "<<
@@ -1325,7 +1310,7 @@ Uint32 StressTestControllerCommand::execute (
                         //
                         // Adding all the required parameters for the command.
                         //
-                        act_command.append(_clientCommands[j].getCString());
+                        act_command.append(_clientCommands.get()[j]);
                         act_command.append(" -clientid ");
                         sprintf(str,"%d",actual_client); 
                         act_command.append(str);
@@ -1531,12 +1516,13 @@ Uint32 StressTestControllerCommand::execute (
                     // 
                     // Stop only running clients as required.
                     //
-                    if (!clientStopped[clientID])
+                    if (!clientStopped.get()[clientID])
                     {
                         // 
                         // If Client's duration is up
                         //
-                        if (clientStopMilliseconds[clientID]<= nowMilliseconds)
+                        if (clientStopMilliseconds.get()[clientID] <=
+                                nowMilliseconds)
                         {
                             // 
                             // Stop all the instances of this client
@@ -1602,29 +1588,30 @@ Uint32 StressTestControllerCommand::execute (
                             //
                             // indicate that the client was stopped. 
                             //
-                            clientStopped[clientID] = true;
+                            clientStopped.get()[clientID] = true;
                             // 
                             // If the Client has a Wait time
                             //
-                            if (_clientDelays[clientID] !=0)
+                            if (_clientDelays.get()[clientID] !=0)
                             {
-                                clientDelayMilliseconds[clientID] = 
-                                    nowMilliseconds + _clientDelays[clientID];
-                                clientDelayed[clientID] = true;
+                                clientDelayMilliseconds.get()[clientID] = 
+                                    nowMilliseconds +
+                                        _clientDelays.get()[clientID];
+                                clientDelayed.get()[clientID] = true;
                             }
                         } /* if (clientStopMilliseconds[clientID]<= nowMilli..*/
-                    }  /*  if (!clientStopped[clientID]) */
+                    }  /*  if (!clientStopped.get()[clientID]) */
                     else 
                     {
                         //
                         // Only restart clients that are waiting.
                         //
-                        if (clientDelayed[clientID])
+                        if (clientDelayed.get()[clientID])
                         {
                             //
                             // When waiting period is consumed.
                             //
-                            if (clientDelayMilliseconds[clientID]<= 
+                            if (clientDelayMilliseconds.get()[clientID] <=
                                 nowMilliseconds)
                             {
                                 //
@@ -1639,17 +1626,19 @@ Uint32 StressTestControllerCommand::execute (
                                     act_command.append("start ");
 #endif
                                     act_command.append(
-                                        _clientCommands[clientID].getCString());
+                                        _clientCommands.get()[clientID]);
                                     act_command.append(" -clientid ");
                                     sprintf(str,"%d",clientID+instanceID); 
                                     act_command.append(str);
                                     act_command.append(" -pidfile ");
                                     act_command.append(" \"");
-                                    act_command.append(_stressTestClientPIDFile);
+                                    act_command.append(
+                                        _stressTestClientPIDFile);
                                     act_command.append("\"");
                                     act_command.append(" -clientlog");
                                     act_command.append(" \"");
-                                    act_command.append(_stressTestClientLogFile);
+                                    act_command.append(
+                                        _stressTestClientLogFile);
                                     act_command.append("\"");
                                     act_command.append("&");
                                     log_file<<"Restarting client:("<<
@@ -1685,13 +1674,13 @@ Uint32 StressTestControllerCommand::execute (
                                     }
                                     clientActive[clientID+instanceID] = true;
                                 } /* for (int instanceID =0;instanceID .. */
-                                clientStopMilliseconds[clientID] = 
+                                clientStopMilliseconds.get()[clientID] = 
                                     nowMilliseconds + 
-                                    _clientDurations[clientID];
-                                clientStopped[clientID] = false;
-                                clientDelayed[clientID] = false;
+                                        _clientDurations.get()[clientID];
+                                clientStopped.get()[clientID] = false;
+                                clientDelayed.get()[clientID] = false;
                             }/* if(clientDelayMilliseconds[clientID]<=nowMi.. */
-                        } /* if(clientDelayed[clientID]) */
+                        } /* if(clientDelayed.get()[clientID]) */
                     } /* else ..*/
                 } /* for(Uint32 clientID=0;clientID < _clientCount;clientID++)*/
             } /* else for if(!actual_client) */
@@ -1935,7 +1924,7 @@ Boolean StressTestControllerCommand::getFileContent(
                 {
                     cout<<"     "<<name<<"\t= "<<value<<endl;
                 }
-                if (!_propertyTable->insert(name, value))
+                if (!_propertyTable.insert(name, value))
                 {
                     //
                     // Duplicate property, ignore the new property value.
@@ -1984,7 +1973,7 @@ Boolean StressTestControllerCommand::getFileContent(
         cout<<StressTestControllerCommand::COMMAND_NAME<<
             "::Common Properties:"<<endl;
     }
-    for (Table::Iterator i = _propertyTable->start(); i; i++)
+    for (Table::Iterator i = _propertyTable.start(); i; i++)
     {
         log_file<<"      "<<i.key()<<"\t= "<<i.value()<<endl;
         if (verboseEnabled)
@@ -2006,7 +1995,7 @@ Boolean StressTestControllerCommand::getFileContent(
         {
             cout<<"Client("<<j<<")"<<endl;
         }
-        for (Table::Iterator i = _clientTable[j].start(); i; i++)
+        for (Table::Iterator i = _clientTable.get()[j].start(); i; i++)
         {
             log_file<<"    "<<i.key()<<"    = "<<i.value()<<endl;
             if (verboseEnabled)
@@ -2329,7 +2318,8 @@ void StressTestControllerCommand::_getClientOptions(
         }
         if (!(isalpha(*p) || *p == '_'))
         {
-            throw StressTestControllerException(StressTestControllerException::INVALID_OPTION); 
+            throw StressTestControllerException(
+                StressTestControllerException::INVALID_OPTION); 
         }
 
         name.append(*p++);
@@ -2353,7 +2343,8 @@ void StressTestControllerCommand::_getClientOptions(
         //
         if (*p != '=')
         {
-            throw StressTestControllerException(StressTestControllerException::INVALID_OPERATOR); 
+            throw StressTestControllerException(
+                StressTestControllerException::INVALID_OPERATOR); 
         }
 
         p++;
@@ -2385,11 +2376,13 @@ void StressTestControllerCommand::_getClientOptions(
 
         if(*p !=']' && *p != ',')
         {
-            throw StressTestControllerException(StressTestControllerException::MISSING_BRACE); 
+            throw StressTestControllerException(
+                StressTestControllerException::MISSING_BRACE); 
         }
         if(value == String::EMPTY)
         {
-            throw StressTestControllerException(StressTestControllerException::MISSING_VALUE); 
+            throw StressTestControllerException(
+                StressTestControllerException::MISSING_VALUE); 
         }
            
 #ifdef STRESSTEST_DEBUG
@@ -2411,7 +2404,7 @@ void StressTestControllerCommand::_getClientOptions(
         //
         // Save client property in client table if valid.
         //
-        if (!_clientTable[_currClientCount].insert(name,value))
+        if (!_clientTable.get()[_currClientCount].insert(name,value))
         {
             //
             // Duplicate property, ignore the new property value.
@@ -2974,18 +2967,17 @@ Boolean StressTestControllerCommand::_storeClientDetails(
     {
         Total_Clients += NEW_CLIENTS;
         Table* tempClientTable = new Table[Total_Clients]; 
-        for (Uint32 i =0;i<_clientCount;i++)
+        for (Uint32 i = 0; i < _clientCount; i++)
         {
-            tempClientTable[i] = _clientTable[i];
+            tempClientTable[i] = _clientTable.get()[i];
         }
-        delete [] _clientTable;
-        _clientTable = tempClientTable;
-    }         
+        _clientTable.reset(tempClientTable);
+    }
 
     // 
     // Store the client Name in the table
     // 
-    if (!_clientTable[_clientCount].insert(NAME, name))
+    if (!_clientTable.get()[_clientCount].insert(NAME, name))
     {
         //
         // Duplicate property, ignore the new property value.
@@ -3000,7 +2992,7 @@ Boolean StressTestControllerCommand::_storeClientDetails(
     // 
     // Store the number of instances for the client in the table
     // 
-    if (!_clientTable[_clientCount].insert(INSTANCE, value))
+    if (!_clientTable.get()[_clientCount].insert(INSTANCE, value))
     {
 
        //
@@ -3174,7 +3166,7 @@ void StressTestControllerCommand::getDefaultClients(ostream& log_file)
         //
         // Adding the default instance value to each client table
         //
-        if (!_clientTable[i].insert(INSTANCE, DEFAULT_INSTANCE))
+        if (!_clientTable.get()[i].insert(INSTANCE, DEFAULT_INSTANCE))
         {
             log_file <<  "Duplicate name already saved: "<<INSTANCE<<endl;
             if (verboseEnabled)
@@ -3186,7 +3178,7 @@ void StressTestControllerCommand::getDefaultClients(ostream& log_file)
         { 
             case 0:
             {
-                if (!_clientTable[i].insert(NAME, MODELWALK_CLIENT))
+                if (!_clientTable.get()[i].insert(NAME, MODELWALK_CLIENT))
                 {
                     log_file <<  "Duplicate name already saved: "<<NAME<<endl;
                     if (verboseEnabled)
@@ -3194,7 +3186,8 @@ void StressTestControllerCommand::getDefaultClients(ostream& log_file)
                         cout<< "Duplicate name already saved: "<<NAME<<endl;
                     }
                 }
-                log_file << "Stress Test Client Name:"<<MODELWALK_CLIENT<< endl; 
+                log_file << "Stress Test Client Name:" << MODELWALK_CLIENT <<
+                    endl;
                 if (verboseEnabled)
                 {
                     cout<< "Stress Test Client Name:"<<MODELWALK_CLIENT<< endl; 
@@ -3204,7 +3197,7 @@ void StressTestControllerCommand::getDefaultClients(ostream& log_file)
             }
             case 1:
             {
-                if (!_clientTable[i].insert(NAME, WRAPPER_CLIENT))
+                if (!_clientTable.get()[i].insert(NAME, WRAPPER_CLIENT))
                 {
                     log_file <<  "Duplicate name already saved: "<<NAME<<endl;
                     if (verboseEnabled)
@@ -3217,7 +3210,7 @@ void StressTestControllerCommand::getDefaultClients(ostream& log_file)
                 {
                     cout << "Stress Test Client Name:" <<WRAPPER_CLIENT<< endl; 
                 }
-                if (!_clientTable[i].insert(CLIENTNAME, "CLI"))
+                if (!_clientTable.get()[i].insert(CLIENTNAME, "CLI"))
                 {
                     log_file<< "Duplicate name already saved: "<<
                         CLIENTNAME<<endl;
@@ -3227,7 +3220,7 @@ void StressTestControllerCommand::getDefaultClients(ostream& log_file)
                             CLIENTNAME<<endl;
                     }
                 }
-                if (!_clientTable[i].insert(OPTIONS, "niall"))
+                if (!_clientTable.get()[i].insert(OPTIONS, "niall"))
                 {
                     log_file<< "Duplicate name already saved: "<<OPTIONS<<endl;
                     if (verboseEnabled)
index a6d74f02e6fa4632a2f8b09462f720df45cd067a..f83ddf2cb7bb4460f6e099549d29738eb1212b80 100644 (file)
 //
 //==============================================================================
 //
-// Author: John Alex (IBM)
-//
-// Modified By:
-//
 //%/////////////////////////////////////////////////////////////////////////////
 
 #ifndef Pegasus_StressTestControllerCommand_h
@@ -40,6 +36,7 @@
 
 #include <Pegasus/Common/String.h>
 #include <Pegasus/Common/HashTable.h>
+#include <Pegasus/Common/AutoPtr.h>
 #include <Clients/cliutils/Command.h>
 #include <Clients/cliutils/CommandException.h>
 
@@ -166,8 +163,8 @@ public:
     Uint32 getOperationType(){return _operationType;}
 
     /**
-        Populate test with default configuration values if default configuration file
-        is not found.
+        Populate test with default configuration values if default
+        configuration file is not found.
 
         @return 
                
@@ -328,11 +325,10 @@ private:
      */
     String _portNumberStr;
     Uint32 _portNumber;
-    Uint32 _port;  // JA not sure..if needed
 
     /**
         A Boolean indicating whether a port number was specified on the
-       command line.
+        command line.
      */
     Boolean _portNumberSpecified;
 
@@ -488,27 +484,27 @@ private:
     /**
         Property table that stores the properties
      */
-    Table* _propertyTable;
+    Table _propertyTable;
 
     /**
         Client table that stores the client specific properties
      */
-    Table* _clientTable;
+    AutoArrayPtr<Table> _clientTable;
 
     /**
         Client commands
      */
-    String* _clientCommands;
+    AutoArrayPtr<String> _clientCommands;
 
     /**
         Client specific durations
      */
-    Uint64* _clientDurations;
+    AutoArrayPtr<Uint64> _clientDurations;
 
     /**
         Client specific delays
      */
-    Uint64* _clientDelays;
+    AutoArrayPtr<Uint64> _clientDelays;
 
     /**
         The total number of clients for this test
index 648894da79b989625aa8274408b43dd6c5ea3365..ade6f701c22ae32bb5acfe78c077fedb51ae64d0 100644 (file)
 //
 //==============================================================================
 //
-// Author: John Alex
-//
-// Modified By:
-//
 //%/////////////////////////////////////////////////////////////////////////////
 
 #include <iostream>
@@ -106,7 +102,7 @@ int main (int argc, char* argv [])
     tmTime = getCurrentActualTime();
     strftime(strTime,256,"%d%m%Y%H%M%S.",&tmTime);
    
-    StressTestControllerCommand command=StressTestControllerCommand();
+    StressTestControllerCommand command;
     
     //
     // Generate log files and PID files