SA-MP Forums Archive
Large amx size - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Large amx size (/showthread.php?tid=177114)



[SOLVED] Large amx size - Cypog - 16.09.2010

The size of my gamemode has extremly risen since using a specific version of 0.2.
Unfortunately, this hasn't changed in 0.3.

This may not be a problem with small gamemodes, but my amx, wich has allways been about 800kb, now has a size of 3600kb.

I wanted to find out, why this happened, so i viewed the amx with a Hex Editor and I found many empty (NULL) byte blocks, wich my be the explaination of this problem.

It's not a big problem, it just causes waste of time, but I hope you can fix this in the next "server" update.


Re: Large amx size - cessil - 16.09.2010

pretty sure it'd be your fault creating so many variables


Re: Large amx size - Cypog - 16.09.2010

pretty sure it's not, cause I didn't change anything on my gamemode, when changing the sa-mp version.

Please only serious answers


Re: Large amx size - JernejL - 16.09.2010

Quote:
Originally Posted by Cypog
Посмотреть сообщение
pretty sure it's not, cause I didn't change anything on my gamemode, when changing the sa-mp version.

Please only serious answers

Edit: This is no scripting discussion, please move it back to the right topic.
Why do you think it should not have changed in size? the MAX_* constants have changed, it's guaranteed to be of different size.

WHY IS THIS A BUG WHEN YOU DON'T UNDERSTAND HOW AMX WORKS?


Re: Large amx size - Cypog - 16.09.2010

Quote:

I found many empty (NULL) byte blocks

Why should many large blocks of NULLs not be a bug?


Re: Large amx size - Voldemort - 16.09.2010

Check all places, where you use
pawn Код:
new ...[Amount];
, to see what I mean try to make
pawn Код:
new Thing[100000];
and you will see that amx compiled will be about 100MBs.


Re: Large amx size - Cypog - 16.09.2010

I'm not saying it's a bug in the server, but in the development files of sa-mp.

As I told:
I did not change anything in my gamemode at this time.

Yes, the MAX_ constants may have changed, but the size of a gamemode shouldn't explode.

In 0.3b the MAX_ constants also changed, but my gamemode size didn't explode again.

And why did small gamemodes not have an extreme growing of size?

Maybe it's not a "bug", but somebody should proove it, who knows how the amx exactly works.


Re: Large amx size - Voldemort - 16.09.2010

Maybe you use some inlcude what isn't "smart made" and that why size increasing so much


Re: Large amx size - Cypog - 16.09.2010

I have many includes, but as i told: I didn't change my script.

I will compare my script with other scripts I made and report my researches.


Re: Large amx size - Cypog - 16.09.2010

I never use these constants in my script, I always use me own constants, because I really care about performance in my scripts.

So how can this be?

Edit:
After some research, I found out, that there's really a constant wich causes this problem, I will report wich one and why after having a closer look to it.


EditІ:
I found out, that it is a design fault in one of my includes:

#if !defined PLAYER_SLOTS

#define PLAYER_SLOTS MAX_PLAYERS

#endif

I didn't change my script, but the constants did, thanks for this advice.

Editі:
This is how I fixed it:

#undef MAX_PLAYERS

#define MAX_PLAYERS 20

I recommend to everybody who's using the MAX_PLAYERS constant to redefine it to a realistic value