Possible memory leak?
#1

When i first start up my server it uses around 10-15 MB of ram and stays around that area even with a good 25-30 players online.
But, after a couple of hours the ram will increase to up to 70-80MB (even with 5-10 players online), and if left for a couple more hours it will rises up to 100 - 150 MB (this could be over 24hours)

Right now
Quote:

Memory usage: 162.03 mb

and it will keep rising im guessing. after checking the logs i have noticed that my server has crashed over night due the the memory usage

There's nothing that would require a lot of ram in my gamemode, no badly coded timers or anything, although i do have large player variable structures that all get used while the player is playing.
I'm currently using the MySQL plug-in from gstylez (i updated it a few days ago thinking it could be the problem but no change)


Is this a memory leak, if so what can be causing such a high ram usage? (i only use 1 plugin which is mysql and 2 filterscripts which are just for animations and such)
Thanks for any help or advice you can give.
Reply
#2

If the RAM usage is climbing in time I'd say it's some kind of timer that fills an array.

look through your timers, and check if their filling arrays, check if their resetting the arrays too.

Now I dunno if you're using PVars, so if you're just using the player array, make sure their reset on disconnect/gamemodeexit.

Reply
#3

Hi Joe, thanks for the reply.

Now, i currently am only using 2 timers that updates arrays (syncing the clock for everyone, and player ranks (how long they have played))
I've checked over the rest of my timers and none look bad in terms of array updating.

I don't use the PVar system as this gamemode was coded before they was around and would take a long time to convert, however like i said i use a lot of variables/arrays (which are all used)
but i don't think it would make that much difference due to the fact when 25-30 players are online, nearly most of these variables/arrays are filled and the memory usage stays the same.

My server has 32 slots and has been redefined in pawn, which is also the same for MAX_VEHICLES at 1000.

pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 32
#undef MAX_VEHICLES
#define MAX_VEHICLES 1000
Reply
#4

PAWN is static, so there is no way any of your scripts are causing a memory leak, unless you use PVars, but as you said, you don't. One of the possible culprits may be a faulty plugin
Reply
#5

As i said i'm only using 1 plugin which is mysql from gstylez (updated to the latest version)

I also forgot to mention i have #pragma dynamic in my script (its currently as low as possible, i do have as-low-as-possible array sizes), could this be the problem?
Reply
#6

Sorry I don't fully understand.

What is '#pragma dynamic' ?

I'm not a noob in pawn, just never heard of it, what does it do?

And "slow as possible" arrays, why not make them faster?

Can you give me the slow arrays for me to take a peak? I can calculate the approx. RAM usage.
Reply
#7

Quote:
Originally Posted by Joe_
What is '#pragma dynamic' ?
From wiki:

Quote:

dynamic - value (generally a power of 2) - Sets the size of memory assigned to the stack and heap. Required if you get the excess memory usage warning after compilation (a wierd table after the co

Reply
#8

Quote:
Originally Posted by Hiddos
Quote:
Originally Posted by Joe_
What is '#pragma dynamic' ?
From wiki:

Quote:

dynamic - value (generally a power of 2) - Sets the size of memory assigned to the stack and heap. Required if you get the excess memory usage warning after compilation (a wierd table after the co

Thankyou, sorry for not going to wiki.
Reply
#9

I've managed to get rid of my heap stack warnings, and still waiting to test it.
After the next day:

Quote:

Memory usage: 263.3 mb

We had a full server last night, so every variable/array was most likely filled, but overnight with 5-10 people its still creeping up.
I'm trying to leave it as long as possible to see what it will do.
Reply
#10

So, why was my post, which was the answer to your problem, completely ignored ?
Free the mysql result after you dont need it anymore
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)