Changeset 17017


Ignore:
Timestamp:
08/19/13 13:05:59 (11 years ago)
Author:
ogrimm
Message:
Fixed bug in History server caausing excessive memory allocation (signed instead of unsigned integers were compared)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/Evidence/History.cc

    r12940 r17017  
    3131const int MIN_SIZE_KB = 50;                                     // Min and max buffersize in kByte (> 3*sizeof(int) !)
    3232const string DEFAULT_MAX_SIZE_KB = "2000";
    33 const string DEFAULT_NUM_ENTRIES = "1000";      // Number of entries in each history buffer
     33const string DEFAULT_NUM_ENTRIES = "1000";              // Number of entries in each history buffer
    3434const double MIN_SAVE_PERDIOD = 0.5;                    // Minimum period between saving history buffers in hours
    3535
     
    172172
    173173  // Resize buffer if necessary
    174   int NEntries = atoi(GetConfig("numentries").c_str());
    175   if (Map[Service].Buffer.size() < NEntries*I->getSize()) {
    176         if (NEntries*I->getSize() < atoi(GetConfig("maxsize_kb").c_str())*1024) {
    177           Map[Service].Buffer.resize(NEntries*I->getSize());
    178         }
     174  unsigned long TargetSize = atoi(GetConfig("numentries").c_str()) * I->getSize();
     175
     176  if (Map[Service].Buffer.size() < TargetSize && TargetSize < atoi(GetConfig("maxsize_kb").c_str())*1024) {
     177          Map[Service].Buffer.resize(TargetSize);
    179178  }
    180179
Note: See TracChangeset for help on using the changeset viewer.