SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/07/2017, 03:18 PM   #1
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,920
Reputation: 258
Default AMX Size [Header/Code/...]

Hello.
We are few developer who works on a new gamemode whith the idea of an old gamemode (both are private).
We faced up to on a problem about compiler infos. We are like 25-30% of the new gamemode.
The oldgame compile with those infos:
Code:
Header size:          22200 bytes
Code size:          6054788 bytes
Data size:         10716556 bytes
Stack/heap size:      50000 bytes; estimated max. usage=12298 cells (49192 bytes)
Total requirements:16843544 bytes
There is no optimization and no new usefull include are used (foreach, zcmd, ...).
So.. The new gamemode have this:
Code:
Header size:          15744 bytes
Code size:          1027576 bytes
Data size:          6641048 bytes
Stack/heap size:      16384 bytes; estimated max. usage=2363 cells (9452 bytes)
Total requirements: 7700752 bytes
Code:
#include "..\includes\a_mysql"			// R41			https://github.com/pBlueG/SA-MP-MySQL/
#include "..\includes\streamer"			// 2.8.2		https://github.com/samp-incognito/samp-streamer-plugin/
#include "..\includes\sscanf2"			// 2.8.2		https://github.com/maddinat0r/sscanf/
#include "..\includes\izcmd"			// 0.2.3.0		http://forum.sa-mp.com/showthread.php?p=3475795
#include "..\includes\colandreas"		// 1.4.0		https://github.com/Pottus/ColAndreas/
#include "..\includes\mSelection"		// 1.1			http://forum.sa-mp.com/showthread.php?t=407045
#include "..\includes\YSF"				// R19			http://forum.sa-mp.com/showthread.php?t=513499
#include "..\includes\YSI\YSI_data\y_foreach"
I'm posting here because I found this http://forum.sa-mp.com/showpost.php?...06&postcount=2 from Vince.

I think the problem come from a lot of Iterator + 2D / 3D arrays (we don't use 4D arrays since it's too heavy). Have you any ideas, tips or something?
__________________
actor_plus - v5.0.2
« I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath »
Dayrion is offline   Reply With Quote
Old 03/07/2017, 08:40 AM   #2
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,920
Reputation: 258
Default Re: AMX Size [Header/Code/...]

Bump!
__________________
actor_plus - v5.0.2
« I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath »
Dayrion is offline   Reply With Quote
Old 03/07/2017, 03:31 PM   #3
Freedom.
Big Clucker
 
Join Date: Oct 2012
Posts: 123
Reputation: 8
Default Re: AMX Size [Header/Code/...]

If there is no lag and too much memory usage, It'll be no problem.

Here is mine: (optimized)

Code:
Header size:          19516 bytes
Code size:          1584804 bytes
Data size:          3456804 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 5077508 bytes
Freedom. is offline   Reply With Quote
Old 03/07/2017, 06:42 PM   #4
GoldenLion
Gangsta
 
GoldenLion's Avatar
 
Join Date: Sep 2014
Location: Estonia
Posts: 949
Reputation: 141
Default Re: AMX Size [Header/Code/...]

Just don't make large local arrays or if you still need to then use packed arrays.
GoldenLion is offline   Reply With Quote
Old 04/07/2017, 02:43 AM   #5
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,920
Reputation: 258
Default Re: AMX Size [Header/Code/...]

I think Iterators are the main source of this problem.
I'll use a for loop with the classic boolean "IsCreated" in the enum of the variable.
__________________
actor_plus - v5.0.2
« I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath »
Dayrion is offline   Reply With Quote
Old 04/07/2017, 05:07 AM   #6
Beryllium
Banned
 
Join Date: May 2017
Location: Egypt.
Posts: 69
Reputation: 4
Default Re: AMX Size [Header/Code/...]

Totally, It happened to me before, It completely means that you've reached the limit of string size, I am not sure of that but when it was happening to me, I tried that an it works.
Beryllium is offline   Reply With Quote
Old 04/07/2017, 02:26 PM   #7
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,920
Reputation: 258
Default Re: AMX Size [Header/Code/...]

Quote:
Originally Posted by Beryllium View Post
Totally, It happened to me before, It completely means that you've reached the limit of string size, I am not sure of that but when it was happening to me, I tried that an it works.
Iterator was the problem?
__________________
actor_plus - v5.0.2
« I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath »
Dayrion is offline   Reply With Quote
Old 04/07/2017, 02:45 PM   #8
GoldenLion
Gangsta
 
GoldenLion's Avatar
 
Join Date: Sep 2014
Location: Estonia
Posts: 949
Reputation: 141
Default Re: AMX Size [Header/Code/...]

Quote:
Originally Posted by Dayrion View Post
Iterator was the problem?
There's nothing to do with the iterators. One thing that most people do is save player's stats on disconnect so it's a long query and they use like 2048 cells. Just use packed arrays or don't make them too big and you are good.
GoldenLion is offline   Reply With Quote
Old 04/07/2017, 02:54 PM   #9
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,920
Reputation: 258
Default Re: AMX Size [Header/Code/...]

Quote:
Originally Posted by GoldenLion View Post
There's nothing to do with the iterators. One thing that most people do is save player's stats on disconnect so it's a long query and they use like 2048 cells. Just use packed arrays or don't make them too big and you are good.
No'p. As I said previously, I already optimized all of my "string". This is the most important part of optimization.
PHP Code:
    new query[75];
    new 
query[220];
    new 
query[100];
... 
I'm pointing the fact I'm using Iterator because I've a lot of Iterator (single/multi dimensions). In ******'s include internal, it's creating also array (for multi-dimensional array, it's bigger : size1 + size2)
Soo.. I've a lot of multi-dimensional array with, sometimes, a big size (1300 for MAX_VEHICLES). At the end, that take a lot of memory usage/...
__________________
actor_plus - v5.0.2
« I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath »
Dayrion is offline   Reply With Quote
Old 04/07/2017, 03:36 PM   #10
Beryllium
Banned
 
Join Date: May 2017
Location: Egypt.
Posts: 69
Reputation: 4
Default Re: AMX Size [Header/Code/...]

Quote:
Originally Posted by GoldenLion View Post
There's nothing to do with the iterators. One thing that most people do is save player's stats on disconnect so it's a long query and they use like 2048 cells. Just use packed arrays or don't make them too big and you are good.
That's what was I am talking about. Almost after 1150 cell, You will have this problem.
Beryllium is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header size MerryDeer Scripting Help 3 18/09/2016 06:57 PM
Compiler message about header, code, stack, heap size Magic_Time Scripting Help 6 22/10/2014 04:21 PM
Header size. audriuxxx Scripting Help 2 11/06/2013 01:32 PM
Header size, coder size, data size compiling warning Red_Dragon. Scripting Help 11 16/05/2013 12:58 PM
Header, code, data etc. size - подскажите по поводу оптимизации Maikkk Русский/Russian 18 25/11/2012 05:46 PM


All times are GMT. The time now is 10:23 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.