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

Solved Memory leakage caused by not destroying menu properly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-22-2021 , 13:37   Memory leakage caused by not destroying menu properly
Reply With Quote #1

Error log :-
Spoiler


Code :-

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-28-2021 at 08:42.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-22-2021 , 16:00   Re: Invalid array handler
Reply With Quote #2

Show when array is created and when task is created
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-22-2021 , 16:15   Re: Invalid array handler
Reply With Quote #3

its already shown in the code, the problem is some bad algorithm i am sure about it.
__________________
@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
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-22-2021 , 16:43   Re: Invalid array handler
Reply With Quote #4

Did you try making 1 the minimum valid array handle, instead of 0?
__________________
Bugsy is online now
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-22-2021 , 17:59   Re: Invalid array handler
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
its already shown in the code, the problem is some bad algorithm i am sure about it.
I mean, when are called. The function name.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-22-2021 , 19:54   Re: Invalid array handler
Reply With Quote #6

Invalid_Array is 0 not -1

Quote:
/**
* Cellarray tag declaration
*
* @note These dynamic arrays are intended to be used for a form of global
* storage without requiring a #define that needs to be increased each
* time the plugin author requires more storage. These are not designed
* to be a full replacement for normal arrays, as those are faster and
* should be used whenever possible.
* @note Plugins are responsible for freeing all Array handles they acquire,
* including those from ArrayClone. Failing to free handles will result
* in the plugin and AMXX leaking memory.
*/
enum Array
{
Invalid_Array = 0
};
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-23-2021 , 00:32   Re: Invalid array handler
Reply With Quote #7

So there is a problem caused of memory leak i am assuming some of the arrays are been created are not freed altho i am freeing them in remove_hudtask function which is called when an event occurred now the tasks and hudmsgs are removed but i am not sure if the arrays are freed.

I am going to do some debugging and I'll post the results the only problem is its hard to tell when the error occurs.


Quote:
Originally Posted by Shadows Adi View Post
I mean, when are called. The function name.
The function is called when an special event occurs.
__________________
@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-23-2021 at 00:39.
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-23-2021 , 11:59   Re: ArrayCreate returns invalid array index
Reply With Quote #8

Fixed a small bug but the issue is now alot better.

PHP Code:
if(g_aHUDMSG_DATA 

PHP Code:
if(aHUDMSG_DATA 
__________________
@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
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-23-2021 , 14:35   Re: ArrayCreate returns invalid array index
Reply With Quote #9

1. Make some debugging to make sure that you pass correct array handle ID.

2.
Code:
static index, target, szString[16], aHUDMSG_DATA[Hudmessage_SetTask_Data], iTempArray, iTempArrayItem;     iTempArrayItem = str_to_num(params[ copyc(szString, charsmax(szString), params, ' ') ]);     iTempArray = any:str_to_num(szString);
    ArrayGetArray(any:iTempArray, iTempArrayItem, aHUDMSG_DATA); // Error line.
-->>
    ArrayGetArray(Array:iTempArray, iTempArrayItem, aHUDMSG_DATA); // Error line.

3. I can't see the purpose of using "any:" everywhere, can you explain why are you using? You just get confused by using that.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-23-2021 , 15:49   Re: ArrayCreate returns invalid array index
Reply With Quote #10

Quote:
Originally Posted by Shadows Adi View Post
1. Make some debugging to make sure that you pass correct array handle ID.
that not the case it returns an invalid array id because there's a memory leak some how, i am doing some debugs be right back with a solution pretty soon, so far i've tested it and every array been created it gets removed which is a good sign.

Quote:
Originally Posted by Shadows Adi View Post
3. I can't see the purpose of using "any:" everywhere, can you explain why are you using? You just get confused by using that.
to avoid compilation warnings, and its not that confusing tbh.
__________________
@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-23-2021 at 15:49.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Old 07-25-2021, 18:30
Natsheh
This message has been deleted by Natsheh.
Reply


Thread Tools
Display Modes

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 18:43.


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