Does anyone know what else i should do? -
Cypress - 12.07.2011
Well today i looked into my script Memory usage and i noticed the the memory use is way too high. With 19 players some variables for killstreak etc was not working. I have optimized the script but i don't see a big difference. Only 1 mb or something.
Tell me what else i should do to save some memory. Do you have any idea what can cause so much usage?
Re: Does anyone know what else i should do? -
BigETI - 12.07.2011
Reduce using fast callbacks/timer functions. (As OnPlayerUpdate and some fast timers also.)
And reduce also using alot of arrays where you want to store player variables. Use Pvars instead.
Re: Does anyone know what else i should do? -
Cypress - 12.07.2011
Well my OnPlayerUpdate is clear enough though. Well i'll take a look into some timers i have and will try to use pvars. Will let you know tho.
Re: Does anyone know what else i should do? -
Cypress - 12.07.2011
Quote:
Originally Posted by ******
You're joking right? You think 19Mb is a lot? Maybe you should have a look at the memory usage of the browser you used to post this request, just for a comparison. Taking an average RAM size of 2Gb, your script is about 1% of the available memory - you could run 100 servers in that!
If you are having problems with your script it's not the footprint that's the problem - I've had scripts that sort of size with no problems at all. Do you get any messages when compiling?
|
No. I don't get any message. So my memory is good? I though that's it's pretty high.
Re: Does anyone know what else i should do? -
iLinx - 12.07.2011
12mb is average / low usage in terms of memory for a SA:MP server, I wouldn't worry too much about trying to get 1mb lower since most servers today have 2GB+ on them.
Edit: looks like this was already posted.
Re: Does anyone know what else i should do? -
Cypress - 12.07.2011
Then I'll make a support ticket. Thanks you helped a lot.
Re: Does anyone know what else i should do? -
jameskmonger - 12.07.2011
Quote:
Originally Posted by Cypress
Then I'll make a support ticket.
|
Why?
Re: Does anyone know what else i should do? -
Cypress - 12.07.2011
Quote:
Originally Posted by jameskmonger
Why?
|
Wouldn't you like to know why your server lags if CPU usage is 0 and 12 mb of memory usage?
Re: Does anyone know what else i should do? -
BigETI - 12.07.2011
Quote:
Originally Posted by ******
Neither of those will help. If you're concerned about memory footprint, making code faster won't do anything to help. What's more PVars are both slower and less memory efficient than regular variables, so switching to them will make your code WORSE, not better.
Just to explain, a PVar needs the same amount of memory to store the data as the native varaible does, but it needs additional memory to store it's name and where it is in memory, which is why it's less efficient.
|
First of all PVars has its own register where you can store data but if you are using the "new" variables with/without those arrays it'll take some spaces from the RAM since the .amx will include more placeholders to store things in it.
It may be useless to use PVars if you need less placeholders but remember if you start to work with about 50000-200000 cells/placeholders (Typical for RP Servers which includes a huge amount of player variables) it won't be better with those 1D/2D variables and also takes the speed of compiling and running the script.
Re: Does anyone know what else i should do? -
Lorenc_ - 13.07.2011
Quote:
Originally Posted by Cypress
No. I don't get any message. So my memory is good? I though that's it's pretty high.
|
Mines approx 80 lol, may seem fail though blame map andreas!
If you have a server with perhaps more than 256 MB Ram, you're fine or maybe even less (half that)