Script causes Memory Leak / CPU core maxing out

[lua]-snip-[/lua]

For some reason, after a few hours of uptime, My server sits at 14% CPU usage and 2 ticks per second after leaving this running. Does anybody have any idea why? I can’t think of any reason other than having too many global variables being overwritten, but I don’t think that has anything to do with it. The script takes all the money in the database and subtracts the Admin’s who have infinite money. Any ideas?

Why not combine that in to one query?

I’m not the best at SQL, care to give an example?

I only really know BASIC queries that can get me by. :frowning:

-snip-
I don’t know as much as I thought I knew :smiley:

EDIT: Once I figure it out, I’ll post it.
Can’t figure it out… too noobish for this complexity :stuck_out_tongue:

[editline]26th February 2013[/editline]

I can tell you that it would be more efficient to run only 2 queries one after the other one query being sum(money) and the other



"SELECT 'Money' FROM 'Money' WHERE `SteamID`=`STEAMID` or `SteamID`=`STEAMID2` or `SteamID`=`STEAMID3`;"


It would return either a 2d or 3d table… I still don’t get how SQL is returned.

[editline]26th February 2013[/editline]

Also after a little bit the DB is dropped so that the connection is not always opened.

I have a feeling that’s only going to return 1 value.

I checked it with my own database, and it returned a table containing all the values, otherwise I wouldn’t have posted :slight_smile:

Your QM variables are not local.

How much would that have to contribute with lag?

As much as I’d like to help, did you try to isolate part of your code to check which part would cause the leak?

None

It appears combing the query into a single query has fixed the lag, the code has always been a bit weird, sometimes it lags, sometimes it doesn’t, but if I disable it completely the servers are fine.

Thanks guys :slight_smile:

Can I please see the code, i’m sort of having a issue like this and I can’t find the source.