My brain is fuzz topic should be 'properly'. Right now we leak the quest files after we shutdown a dynamic zone (eg. boots up, loads quests, shuts down). When we shutdown on the old code we just cleared the list, but all this data allocates memory before we load it in.
parser.cpp
New Code:
Code:
void Parser::ClearCache() {
#if Parser_DEBUG >= 2
cout << "Parser::ClearCache" << endl;
#endif
//for (int32 i=0; i<pMaxNPCID+1; i++)
// pNPCqstID[i] = -1;
iter_events listIt = MainList.begin();
Events *p;
EventList *pp;
while (listIt != MainList.end())
{
p = *listIt;
if ( p )
{
iter_eventlist listIt2 = p->Event.begin();
while (listIt2 != p->Event.end())
{
pp = *listIt2;
if ( pp )
safe_delete(pp);
listIt2++;
}
listIt++;
safe_delete(p);
}
}
safe_delete_array(pNPCqstID);
pNPCqstID = new sint32[1];
npcarrayindex=1;
}
Old Code:
Code:
void Parser::ClearCache() {
#if Parser_DEBUG >= 2
cout << "Parser::ClearCache" << endl;
#endif
//for (int32 i=0; i<pMaxNPCID+1; i++)
// pNPCqstID[i] = -1;
MainList.clear();
safe_delete_array(pNPCqstID);
pNPCqstID = new sint32[1];
npcarrayindex=1;
}