PDA

View Full Version : [Issue] Memory Leak: store-loadouts.smx


JasperLee93
03-31-2016, 14:39
Hi all, I am currently using the latest webpanel, MySQL, plugins and the latest 1.7 snapshot of Sourcemod Windows.

I have recently received a fatal warning:


L 03/28/2016 - 19:38:21: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 03/28/2016 - 19:38:21: [SM] Unloading plugin to free 29773 handles.
L 03/28/2016 - 19:38:21: [SM] Contact the author(s) of this plugin to correct this error.
L 03/28/2016 - 19:38:21: --------------------------------------------------------------------------
L 03/28/2016 - 19:38:21: Type GlobalFwd | Count 1
L 03/28/2016 - 19:38:21: Type Trie | Count 29771
L 03/28/2016 - 19:38:21: Type Cookie | Count 1
L 03/28/2016 - 19:38:21: -- Approximately 10241264 bytes of memory are in use by (29773) Handles.

Are you able to fix this coder? Is anyone facing this issue?

Drixevel
03-31-2016, 16:35
Version?

JasperLee93
04-03-2016, 01:08
Version?

SourceMod Version: Windows 1.7.3-dev+5301

Store: Trails, Chat Colours: v1.1 Alpha (alongub)

Backend, Core, Distributor, Gifting, Inventory, Loadouts, Logging, Refunds, Shop: 1.2 Final

Just happened again, 12 hours ago.


L 04/03/2016 - 00:06:21: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 04/03/2016 - 00:06:21: [SM] Unloading plugin to free 28587 handles.
L 04/03/2016 - 00:06:21: [SM] Contact the author(s) of this plugin to correct this error.
L 04/03/2016 - 00:06:21: --------------------------------------------------------------------------
L 04/03/2016 - 00:06:21: Type GlobalFwd | Count 1
L 04/03/2016 - 00:06:21: Type Trie | Count 28585
L 04/03/2016 - 00:06:21: Type Cookie | Count 1
L 04/03/2016 - 00:06:21: -- Approximately 9833280 bytes of memory are in use by (28587) Handles.

JasperLee93
04-19-2016, 10:13
Bump..

Any updates on fixes? Or shd I update to ur new alpha edition?

L 04/08/2016 - 13:08:42: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 04/08/2016 - 13:08:42: [SM] Unloading plugin to free 28698 handles.
L 04/08/2016 - 13:08:42: [SM] Contact the author(s) of this plugin to correct this error.
L 04/08/2016 - 13:08:42: --------------------------------------------------------------------------
L 04/08/2016 - 13:08:42: Type GlobalFwd | Count 1
L 04/08/2016 - 13:08:42: Type Trie | Count 28696
L 04/08/2016 - 13:08:42: Type Cookie | Count 1
L 04/08/2016 - 13:08:42: -- Approximately 9871464 bytes of memory are in use by (28698) Handles.

L 04/19/2016 - 18:11:09: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 04/19/2016 - 18:11:09: [SM] Unloading plugin to free 28847 handles.
L 04/19/2016 - 18:11:09: [SM] Contact the author(s) of this plugin to correct this error.
L 04/19/2016 - 18:11:09: --------------------------------------------------------------------------
L 04/19/2016 - 18:11:09: Type GlobalFwd | Count 1
L 04/19/2016 - 18:11:09: Type Trie | Count 28845
L 04/19/2016 - 18:11:09: Type Cookie | Count 1
L 04/19/2016 - 18:11:09: -- Approximately 9922720 bytes of memory are in use by (28847) Handles.

Drixevel
04-19-2016, 17:51
Bump..

Any updates on fixes? Or shd I update to ur new alpha edition?

L 04/08/2016 - 13:08:42: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 04/08/2016 - 13:08:42: [SM] Unloading plugin to free 28698 handles.
L 04/08/2016 - 13:08:42: [SM] Contact the author(s) of this plugin to correct this error.
L 04/08/2016 - 13:08:42: --------------------------------------------------------------------------
L 04/08/2016 - 13:08:42: Type GlobalFwd | Count 1
L 04/08/2016 - 13:08:42: Type Trie | Count 28696
L 04/08/2016 - 13:08:42: Type Cookie | Count 1
L 04/08/2016 - 13:08:42: -- Approximately 9871464 bytes of memory are in use by (28698) Handles.

L 04/19/2016 - 18:11:09: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 04/19/2016 - 18:11:09: [SM] Unloading plugin to free 28847 handles.
L 04/19/2016 - 18:11:09: [SM] Contact the author(s) of this plugin to correct this error.
L 04/19/2016 - 18:11:09: --------------------------------------------------------------------------
L 04/19/2016 - 18:11:09: Type GlobalFwd | Count 1
L 04/19/2016 - 18:11:09: Type Trie | Count 28845
L 04/19/2016 - 18:11:09: Type Cookie | Count 1
L 04/19/2016 - 18:11:09: -- Approximately 9922720 bytes of memory are in use by (28847) Handles.

Stay tuned.

JasperLee93
04-21-2016, 05:54
Stay tuned.

Okay. Thanks.

JasperLee93
05-18-2016, 02:03
Bump. 1.2.6 STILL memory leaks.

JasperLee93
06-10-2016, 23:59
Bump again.. Any updates..?

L 06/02/2016 - 18:48:40: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/02/2016 - 18:48:40: [SM] Unloading plugin to free 23219 handles.
L 06/02/2016 - 18:48:40: [SM] Contact the author(s) of this plugin to correct this error.
L 06/02/2016 - 18:48:40: --------------------------------------------------------------------------
L 06/02/2016 - 18:48:40: Type GlobalFwd | Count 1
L 06/02/2016 - 18:48:40: Type Trie | Count 23217
L 06/02/2016 - 18:48:40: Type Cookie | Count 1
L 06/02/2016 - 18:48:40: -- Approximately 7986700 bytes of memory are in use by (23219) Handles.

L 06/03/2016 - 21:56:55: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/03/2016 - 21:56:55: [SM] Unloading plugin to free 23097 handles.
L 06/03/2016 - 21:56:55: [SM] Contact the author(s) of this plugin to correct this error.
L 06/03/2016 - 21:56:55: --------------------------------------------------------------------------
L 06/03/2016 - 21:56:55: Type GlobalFwd | Count 1
L 06/03/2016 - 21:56:55: Type Trie | Count 23095
L 06/03/2016 - 21:56:55: Type Cookie | Count 1
L 06/03/2016 - 21:56:55: -- Approximately 7944732 bytes of memory are in use by (23097) Handles.

L 06/05/2016 - 11:11:52: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/05/2016 - 11:11:52: [SM] Unloading plugin to free 24940 handles.
L 06/05/2016 - 11:11:52: [SM] Contact the author(s) of this plugin to correct this error.
L 06/05/2016 - 11:11:52: --------------------------------------------------------------------------
L 06/05/2016 - 11:11:52: Type GlobalFwd | Count 1
L 06/05/2016 - 11:11:52: Type Trie | Count 24938
L 06/05/2016 - 11:11:52: Type Cookie | Count 1
L 06/05/2016 - 11:11:52: -- Approximately 8578724 bytes of memory are in use by (24940) Handles.

L 06/06/2016 - 13:12:41: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/06/2016 - 13:12:41: [SM] Unloading plugin to free 22677 handles.
L 06/06/2016 - 13:12:41: [SM] Contact the author(s) of this plugin to correct this error.
L 06/06/2016 - 13:12:41: --------------------------------------------------------------------------
L 06/06/2016 - 13:12:41: Type GlobalFwd | Count 1
L 06/06/2016 - 13:12:41: Type Trie | Count 22675
L 06/06/2016 - 13:12:41: Type Cookie | Count 1
L 06/06/2016 - 13:12:41: -- Approximately 7800252 bytes of memory are in use by (22677) Handles.

L 06/09/2016 - 08:35:22: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/09/2016 - 08:35:22: [SM] Unloading plugin to free 24577 handles.
L 06/09/2016 - 08:35:22: [SM] Contact the author(s) of this plugin to correct this error.
L 06/09/2016 - 08:35:22: --------------------------------------------------------------------------
L 06/09/2016 - 08:35:22: Type GlobalFwd | Count 1
L 06/09/2016 - 08:35:22: Type Trie | Count 24575
L 06/09/2016 - 08:35:22: Type Cookie | Count 1
L 06/09/2016 - 08:35:22: -- Approximately 8453852 bytes of memory are in use by (24577) Handles.

L 06/10/2016 - 12:19:54: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/10/2016 - 12:19:54: [SM] Unloading plugin to free 24142 handles.
L 06/10/2016 - 12:19:54: [SM] Contact the author(s) of this plugin to correct this error.
L 06/10/2016 - 12:19:54: --------------------------------------------------------------------------
L 06/10/2016 - 12:19:54: Type GlobalFwd | Count 1
L 06/10/2016 - 12:19:54: Type Trie | Count 24140
L 06/10/2016 - 12:19:54: Type Cookie | Count 1
L 06/10/2016 - 12:19:54: -- Approximately 8304212 bytes of memory are in use by (24142) Handles.

L 06/11/2016 - 11:50:32: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "store-loadouts.smx")
L 06/11/2016 - 11:50:32: [SM] Unloading plugin to free 23789 handles.
L 06/11/2016 - 11:50:32: [SM] Contact the author(s) of this plugin to correct this error.
L 06/11/2016 - 11:50:32: --------------------------------------------------------------------------
L 06/11/2016 - 11:50:32: Type GlobalFwd | Count 1
L 06/11/2016 - 11:50:32: Type Trie | Count 23787
L 06/11/2016 - 11:50:32: Type Cookie | Count 1
L 06/11/2016 - 11:50:32: -- Approximately 8182780 bytes of memory are in use by (23789) Handles.

pokemonmaster
06-19-2016, 16:01
I'm not sure why, but according to my findings, SourceMod doesn't properly close handles that were made in other plugins.

An easy fix:
Look for this in store-loadouts.sp

// Line 138
void OpenLoadoutMenu(int client)
{
Handle filter = CreateTrie();
SetTrieString(filter, "game", g_game);
SetTrieValue(filter, "team", GetClientTeam(client));

if (StrEqual(g_game, "tf"))
{
char className[10];
TF2_GetClassName(TF2_GetPlayerClass(client), className, sizeof(className));
SetTrieString(filter, "class", className);
}

Store_GetLoadouts(filter, GetLoadoutsCallback, true, client);

// ********************* ADD THIS RIGHT HERE
CloseHandle(filter);
}

// AND
// Line 246
void FindOptimalLoadoutFor(int client)
{
if (!g_databaseInitialized)
{
return;
}

Handle filter = CreateTrie();
SetTrieString(filter, "game", g_game);
SetTrieValue(filter, "team", GetClientTeam(client));

if (StrEqual(g_game, "tf"))
{
char className[10];
TF2_GetClassName(TF2_GetPlayerClass(client), className, sizeof(className));
SetTrieString(filter, "class", className);
}

Store_GetLoadouts(filter, FindOptimalLoadoutCallback, true, GetClientUserId(client));
// ********************* ADD THIS RIGHT HERE
CloseHandle(filter);
}

Potato Uno
06-22-2016, 12:30
Sourcemod never closes handles for you. You must clean up all handles you make by yourself.

Some natives might close it for you but not all.

pokemonmaster
06-22-2016, 18:59
Sourcemod never closes handles for you. You must clean up all handles you make by yourself.

Some natives might close it for you but not all.

That is not what I meant:

* To use it, set it to a trie with some or all of the above properties.
* IMPORTANT You are *not* resposible for closing the filter trie's handle,
* the store-backend module is.
native void Store_GetLoadouts(Handle filter = INVALID_HANDLE, Store_GetItemsCallback callback = INVALID_FUNCTION, bool loadFromCache = true, any data = 0);