EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Probably dispose of quest files on dynamic zone shutdown (https://www.eqemulator.org/forums/showthread.php?t=33892)

image 07-21-2011 11:48 AM

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;
}



All times are GMT -4. The time now is 05:57 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.