Raised This Month: $32 Target: $400
 8% 

Solved Memory leakage caused by not destroying menu properly


Post New Thread Reply   
 
Thread Tools Display Modes
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-27-2021 , 15:56   Re: ArrayCreate returns invalid array index
Reply With Quote #21

Quote:
Originally Posted by Bugsy View Post
So for every ArrayCreate() called, you output the handle and all are valid? Are you 110% certain that your handle storage mechanism is working correctly?
I didnt output the handle but i outputed the array counts but when an invalid array is returned from ArrayCreate i demolished the set_task from getting called.

Quote:
Originally Posted by Bugsy View Post
I assume you changed these to 0?
PHP Code:
if(iTempArray == any:-1)
//..
if(iTempArray != any:-1ArrayDestroy(iTempArray); 
No they've stayed as they were because -1 meaning the array is not created.

Quote:
Originally Posted by Bugsy View Post
Have you tried passing the handle directly in set_task() and ensure you destroy each one when done?

I forget to mention after the error occurs within a while, bunch of plugins will start getting defecated meaning they will throw a bunch of random errors such as index out of bounds and other errors.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-27-2021 at 15:59.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-27-2021 , 16:26   Re: ArrayCreate returns invalid array index
Reply With Quote #22

I thought it was determined that an invalid handle is 0, not -1?

If other plugins that also use the Array[X] natives also begin erroring when yours does then yeah I think it's a module issue.

Does the handle have a similar value range each time it begins erroring?
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-27-2021 , 17:45   Re: ArrayCreate returns invalid array index
Reply With Quote #23

Quote:
Originally Posted by Bugsy View Post
I thought it was determined that an invalid handle is 0, not -1?

If other plugins that also use the Array[X] natives also begin erroring when yours does then yeah I think it's a module issue.

Does the handle have a similar value range each time it begins erroring?
here's what i did at the temp array creating to prevent the error before calling the set_task.

Spoiler


Here're some random errors...

Code:
L 07/27/2021 - 11:45:18: Invalid player id 0
L 07/27/2021 - 11:45:18: [AMXX] Run time error 10 (plugin "cs_player_models_api.amxx") (native "set_user_info") - debug not enabled!
L 07/27/2021 - 11:45:18: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 07/27/2021 - 11:45:18: Invalid array handle provided (0)


L 07/27/2021 - 11:45:18: [AMXX] Displaying debug trace (plugin "jb_effects_system.amxx", version "2.6.6")
L 07/27/2021 - 11:45:18: [AMXX] Run time error 10: native error (native "ArrayGetArray")
L 07/27/2021 - 11:45:18: [AMXX]    [0] jb_effects_system.sma::task_hudmessage_repeat (line 968)
L 07/27/2021 - 11:45:23: Invalid array handle provided (0)

Code:
L 07/27/2021 - 11:52:56: [AMXX] Displaying debug trace (plugin "Jailbreak_main.amxx", version "2.6.6")
L 07/27/2021 - 11:52:56: [AMXX] Run time error 10: native error (native "menu_item_getinfo")
L 07/27/2021 - 11:52:56: [AMXX]    [0] Jailbreak_main.sma::primary_wpnshandle (line 736)
L 07/27/2021 - 11:52:56: Invalid menu id 1(32)

i just found a bug or a potential bug if you may say, some of the players might not have any weapons although this still been called, so if it was called without any weapons in the menu, the menu will simply won't be displayed, so the menu is been created and its not destroyed and it might make a problem latter.

Spoiler
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-27-2021 at 17:46.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-27-2021 , 21:16   Re: ArrayCreate returns invalid array index
Reply With Quote #24

When does iTempArray get set to -1?
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-28-2021 , 04:15   Re: ArrayCreate returns invalid array index
Reply With Quote #25

Quote:
Originally Posted by Bugsy View Post
When does iTempArray get set to -1?
PHP Code:
                    if((z=xArray2[HUDMSG_REPEAT]) >= 1// repeats
                    
{
                        new Array:
iTempArray any:-1iTempArrayItem
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-28-2021 , 08:39   Re: ArrayCreate returns invalid array index
Reply With Quote #26

After a while of observation the server didn't throw any error assuming the fix of the potential bug in post #23 has fixed the problem.

TIP always destroy the menus after done using them or if you didn't use them at all make sure they're destroyed.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-29-2021 at 08:53.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 13:47.


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