AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   About destroying Array (https://forums.alliedmods.net/showthread.php?t=220774)

dFF 07-14-2013 08:46

About destroying Array
 
For example i create an array like: g_aArray = ArrayCreate( 32, 1 )
it is necessary to destroy g_aArray in plugin_end to prevent memory leak, or the server is already destroy array like in Trie case (also see #78 post) ?

ConnorMcLeod 07-14-2013 08:48

Re: About destroying Array
 
You don't need to destroy dynamic arrays or tries, it is done internally.

dFF 07-14-2013 08:51

Re: About destroying Array
 
Hmm .. for curiosity where can i found these ? in amxx source ?

Anyway thanks for reply, now it's ok.
Thanks.

ConnorMcLeod 07-14-2013 10:19

Re: About destroying Array
 
meta_api.cpp

Code:

// Very        first point        at map load
// Load        AMX        modules        for        new        native functions
// Initialize AMX stuff        and        load it's plugins from plugins.ini list
// Call        precache forward function from plugins
int        C_Spawn(edict_t *pent)

Arrays :
Code:

        for (unsigned int i=0; i<VectorHolder.size(); i++)
        {
                delete VectorHolder[i];
        };
        VectorHolder.clear();

Tries :
Code:

        g_TrieHandles.clear();
So, you can delete at plugin_end() but it is not required because it is deleted at new map.

dFF 07-14-2013 10:32

Re: About destroying Array
 
Thank you ! :mrgreen:


All times are GMT -4. The time now is 06:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.