Raised This Month: $51 Target: $400
 12% 

[sm] memory leak detected in plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-30-2016 , 08:31   [sm] memory leak detected in plugin
Reply With Quote #1

This is mostly a question for the more experienced coders / devs.

So, Dynamic.

I've got someone loading "scripts/items/items_game.txt" which is a massive file.

This appears in the server console:

Code:
L 05/30/2016 - 20:33:58: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "dynamic.smx")
L 05/30/2016 - 20:33:58: [SM] Unloading plugin to free 32650 handles.
L 05/30/2016 - 20:33:58: [SM] Contact the author(s) of this plugin to correct this error.
L 05/30/2016 - 20:33:58: --------------------------------------------------------------------------
L 05/30/2016 - 20:33:58: TypeFile                |Count1
L 05/30/2016 - 20:33:58: TypePrivateFwd          |Count6528
L 05/30/2016 - 20:33:58: TypeTrie                |Count6530
L 05/30/2016 - 20:33:58: TypeCellStack           |Count1
L 05/30/2016 - 20:33:58: TypeCellArray           |Count19589
L 05/30/2016 - 20:33:58: TypeRegex               |Count1
L 05/30/2016 - 20:33:58: -- Approximately 53107344 bytes of memory are in use by (32650) Handles.
Is there any way to override this limitation?


Spoiler
__________________

Last edited by Neuro Toxin; 05-30-2016 at 08:33.
Neuro Toxin is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-30-2016 , 09:58   Re: [sm] memory leak detected in plugin
Reply With Quote #2

No, the limit is in the SM binary itself. To override it is to have SM users recompile SM themselves with a new limit set.
https://github.com/alliedmodders/sou...andleSys.h#L42

Last edited by WildCard65; 05-30-2016 at 10:01.
WildCard65 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-30-2016 , 18:52   Re: [sm] memory leak detected in plugin
Reply With Quote #3

It would be really nice if dynamic could do something like:

#declare HANDLESYS_MAX_HANDLES_BYPASS

I dont have much of a clue in relation to this being possible. I dont know if the upper limit is hard coded or if an if statement just throws an error.
__________________
Neuro Toxin is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-30-2016 , 19:11   Re: [sm] memory leak detected in plugin
Reply With Quote #4

No, the handle limit is compile time constant of sourcemod.logic.dll as the limit itself is a preprocessor define which works the same way as SP preprocessor defines work (in that the define is replaced with it's value in all places it's used in before any compiling is done). Not only that, but the error is only printed for the plugin that owns the MOST handles at the time SM goes and tries to free more handles for it to assign a new handle to a plugin.

Last edited by WildCard65; 05-30-2016 at 19:12.
WildCard65 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-30-2016 , 19:17   Re: [sm] memory leak detected in plugin
Reply With Quote #5

Ok. That's really clear.

Thanks for the info!!!
__________________
Neuro Toxin is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-02-2016 , 01:28   Re: [sm] memory leak detected in plugin
Reply With Quote #6

If I understand correctly, you're pushing each bit of the kv to an array, so very large kv files hit the limit. It would be much less efficient, but if you must cache the whole file, perhaps on kv files > XX size you might combine data chunks into single handles in some way (e.g. CSV or other delimited data would be a simple example, or perhaps saving the section, line breaks and all). Gets messy real fast there though, and uses more processing just to save on handles.

Why did you want dynamic to process kv files anyways? Will dynamic provide a feature more so than coders processing the cfg file themselves and only pushing needed data to dynamic objects (thereby cutting out unneeded data such as tier section names, etc.)?

I love your work making SP more OO, but I'm not understanding the push/payoff to saving entire kv files.
__________________
ThatOneGuy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-02-2016 , 02:41   Re: [sm] memory leak detected in plugin
Reply With Quote #7

Kv is supported so one can serialise/deserialise dynamic objects to disk with one line of code.

The objective of the person reading items.txt is because Dynamic merges duplicate keys if they are named twice in a kv based file.

When i posted this thread. Dynamic used 3 arrays and one trie per Dynamic().

I recently pushed an update to Dynamic that removed one array.

I'm now implementing a const char[] key param so Dynamic can read only the key you want to stop this overkill.
__________________
Neuro Toxin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:54.


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