I have a rather complex data object that uses a row map
typedef std::map<std::string, unsigned int> Event;
typedef std::pair<double, Event> EventGroup;
std::vector<EventGroup> eventVector;
This is a program that always runs in the background to listen to incoming messages. Every time a new EventGroup arrives, which can have any number of lines on the map, I add it to the vector.
// New data came in
eventVector.push_back(newEventGroup);
From time to time I will erase this vector
//Flush some of the data because it old
// it been determined that the index to erase at is flushIndex
eventVector.erase(eventVector.begin(), eventVector.begin()+flushIndex);
Usually this is usually the first 5% of the data.
I noticed that there seems to be a memory leak. Memory usage starts around 50 MB ... but ends around 1 GB before it is too slow and crashing. I heard that this is an expensive erase operation, but could it be causing a memory leak? Am I missing some way to free the memory used by the card?