View Single Post
  #1  
Old 07-21-2011, 11:48 AM
image
Demi-God
 
Join Date: Jan 2002
Posts: 1,290
Default Probably dispose of quest files on dynamic zone shutdown

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;
}
__________________
www.eq2emu.com
EQ2Emu Developer
Former EQEMu Developer / GuildWars / Zek Seasons Servers
Member of the "I hate devn00b" club.
Reply With Quote