gemidyne / microtf2

A custom gamemode for Team Fortress 2 - Players compete against each other to get the most points by playing a series of rapid fire microgames in order to win the round!
https://www.gemidyne.com/projects/microtf2
GNU General Public License v2.0
30 stars 17 forks source link

Memory Leak :: CreateEvent (Annotations) #157

Closed EduardoKdinho closed 4 years ago

EduardoKdinho commented 4 years ago

Hello, when the server is full, 24 ~ 28 players, we detected some memory leaks by CreateEvent in Annotations, with few players it doesn't happen, only with a high number of players. This time it happened in the "build anything" minigame.

The plugin stops and you need to change modes (multimod server).

Here is the error log:

`L 01/27/2020 - 14:04:59: [SM] Exception reported: Memory leak L 01/27/2020 - 14:04:59: [SM] Blaming: AS-MicroTF2.smx L 01/27/2020 - 14:04:59: [SM] Call stack trace: L 01/27/2020 - 14:04:59: [SM] [0] CreateEvent

L 01/27/2020 - 14:04:59: [SM] [1] Line 140, R:\sourcecode\anarchysteven\microtf2\src\scripting\Stocks.sp::ShowAnnotationWithBitfield

L 01/27/2020 - 14:04:59: [SM] [2] Line 135, R:\sourcecode\anarchysteven\microtf2\src\scripting\Stocks.sp::ShowAnnotation L 01/27/2020 - 14:04:59: [SM] [3] Line 483, R:\sourcecode\anarchysteven\microtf2\src\scripting\MethodMaps/Player.inc::Player.ShowAnnotation

L 01/27/2020 - 14:04:59: [SM] [4] Line 594, R:\sourcecode\anarchysteven\microtf2\src\scripting\AS- MicroTF2.sp::Timer_GameLogic_EndMinigame`

safalin1 commented 4 years ago

Thanks for the report!

We unfortunately missed this in our testing -- #158 appears to fix this as it correctly closes off the underlying handle for the event. Im looking into release this as an emergency fix right now. Will comment once this release is available

EduardoKdinho commented 4 years ago

I really appreciate your help, I have my multimod server full most of the time and suddenly the players left, I decided to check why it was happening.

safalin1 commented 4 years ago

The release is now available - https://github.com/gemidyne/microtf2/releases/tag/v3.0.1

The only thing you need from the plugin.zip will be the plugin's smx file - no other files were changed :)

EduardoKdinho commented 4 years ago

Well , still. :( - 22 players.

L 01/27/2020 - 18:25:49: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "AS-MicroTF2.smx") L 01/27/2020 - 18:25:49: [SM] Unloading plugin to free 30179 handles. L 01/27/2020 - 18:25:49: [SM] Contact the author(s) of this plugin to correct this error. L 01/27/2020 - 18:25:49: -------------------------------------------------------------------------- L 01/27/2020 - 18:25:49: Type GameEvent | Count 30040 L 01/27/2020 - 18:25:49: Type GameConfigs | Count 1 L 01/27/2020 - 18:25:49: Type Timer | Count 88 L 01/27/2020 - 18:25:49: Type GlobalFwd | Count 13 L 01/27/2020 - 18:25:49: Type PrivateFwd | Count 29 L 01/27/2020 - 18:25:49: Type Trie | Count 2 L 01/27/2020 - 18:25:49: Type CellArray | Count 3 L 01/27/2020 - 18:25:49: Type HudSyncObj | Count 2 L 01/27/2020 - 18:25:49: Type ValveCall | Count 1 L 01/27/2020 - 18:25:49: -- Approximately 50508 bytes of memory are in use by (30179) Handles.

L 01/27/2020 - 18:25:49: [SM] Exception reported: Memory leak L 01/27/2020 - 18:25:49: [SM] Blaming: AS-MicroTF2.smx L 01/27/2020 - 18:25:49: [SM] Call stack trace: L 01/27/2020 - 18:25:49: [SM] [0] CreateEvent L 01/27/2020 - 18:25:49: [SM] [1] Line 140, R:\sourcecode\anarchysteven\microtf2\src\scripting\Stocks.sp::ShowAnnotationWithBitfield L 01/27/2020 - 18:25:49: [SM] [2] Line 135, R:\sourcecode\anarchysteven\microtf2\src\scripting\Stocks.sp::ShowAnnotation L 01/27/2020 - 18:25:49: [SM] [3] Line 483, R:\sourcecode\anarchysteven\microtf2\src\scripting\MethodMaps/Player.inc::Player.ShowAnnotation L 01/27/2020 - 18:25:49: [SM] [4] Line 594, R:\sourcecode\anarchysteven\microtf2\src\scripting\AS-MicroTF2.sp::Timer_GameLogic_EndMinigame

safalin1 commented 4 years ago

Hi, the error above seems to be referring to the method that was fixed - could you confirm if the 3.0.1 plugin is in the plugin folder? (Just incase it hasnt reloaded on the server properly) - the size of the plugin SMX should be exactly 215,671 bytes

EduardoKdinho commented 4 years ago

Sorry, my bad, my plugin manager sent the fix version to disabled folder and now it seems to have solved.

safalin1 commented 4 years ago

Good, glad it has been resolved for you. I will close this issue off for now