Ever since 3c server
#1

My server has been using quite a bit memory and cpu usage. When it's up for a day or so it eats like 30% cpu usage and like 150 mb of ram, What could be the cause of this?

My server config
Код:
echo Executing Server Config...
lanmode 0
password passwordd
mapname 
rcon_password
maxplayers 11
port 
hostname 
gamemode0 
filterscripts 
announce 1
query 1
weburl 
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
plugins mysql streamer sscanf
maxnpc 1
((I do have shit set in gamemode nshit but i removed them for certian reasons)

Not to long ago i started my server up (about 2 hours ago) It started off eating like 19 mb of ram and 0% cpu usage

Now it's at 50 mb of ram and 11% cpu usage

I don't have very many timers. I use foreach for loops.
Reply
#2

creating unnecessary variables inside loops that could work as well if you created the variable before the loop, and just use it inside the loop? (Or in timers)
Reply
#3

I'm sorry but that didn't make any sense to me
Reply
#4

He says that its what you do INSIDE the loops.
And it doesnt matter how many timers, because the only thing that matters is what you do inside the timers.

Try and remove some thing from under OnPlayerUpdate because taht is probably causing lag
Reply
#5

It does that with no player connected?
Reply
#6

Yes it does it with no player connected
Reply
#7

I'm saying this;

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    new string[128];
    format(string, sizeof(string), "Whateveryouformatitto");
}
Is NOT good. It creates a 128 long string * 500 = (64000), which eats up memory.
If you have something LIKE this you should alter It for;

pawn Код:
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
    format(string, sizeof(string), "Whateveryouformatitto");
}
Which only creates the 128 long string that you need instead.
Reply
#8

Hey,
I think thatґs wrong.
Everytime the Block { } is over, the variable isnґt needed anymore and will be deleted by the Pawn Virtual Machine.
If not nearly all servers would be out of memory after a while because you would have to declare all the variables out the functions.

But the second way is better in another way.
The server doesnґt have to allocate memory 500 times.

If something is wrong, Iґm sorry.

And sorry for my english, Iґm german


Casjupaya
Reply
#9

I have taken out all the
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
And changed them to
pawn Код:
foreach(Player,i)
So the only loops i have is for houses business vehicles and other shit. I dunno how to use foreach on them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)