In my VS2010 project, there is a part of the code like:
LRESULT CDlgTrackTime::OnMsgBeginSearch( WPARAM wParam, LPARAM lParam )
{
m_vtFileDay.clear();
m_PlayList.clear();
...
}
where m_vtFileDay
is defined as follows:
typedef struct _tagAVFILEDay_S
{
int nYear;
int nMonth;
int nDay;
char szFolder[MAX_PATH];
}AVFILEDay_S, *LPAVFILEDay_S;
typedef std::vector< AVFILEDay_S > VecFileDay;
When m_vtFileDay.clear()
runs, in vector file as follows:
#if _ITERATOR_DEBUG_LEVEL == 2
if (_Last < _First || _VICONT(_First) != this
|| _VIPTR(_First) < this->_Myfirst
|| this->_Mylast < _VIPTR(_Last))
_DEBUG_ERROR("vector erase iterator outside range");
pointer _Ptr = _Move(_VIPTR(_Last), this->_Mylast,
_VIPTR(_First));
_Orphan_range(_VIPTR(_First), this->_Mylast);
#else
...
VS returns "vector erase iterator outside range" as the debug error message at _ITERATOR_DEBUG_LEVEL == 2
. The local variable at that function level shows that both _Last and _Last_arg points to 0x00000000
while _First_arg and _First are still a valid pointer pointing to a
AVFILEDay_S
.
My question is how I could resolve this problem? Is this a memory leak because szFolder[MAX_PATH] is not properly deleted? Or should I just set _ITERATOR_DEBUG_LEVEL == 1
? Thank you so much!
User contributions licensed under CC BY-SA 3.0