Forum

> > CS2D > General > CS2D Bug Reports
Forums overviewCS2D overviewGeneral overviewLog in to reply

English CS2D Bug Reports

2,058 replies
Page
To the start Previous 1 233 34 35102 103 Next To the start

old Lua Memory Leak

BCG2000
User Off Offline

Quote
I'm not sure if this has been reported before, or if someone has noticed it too or if it's happening only to me, but here we go:

The current version of CS2D has a serious memory leak problem with the Lua module, it affects all Lua scripts (from what I saw).

I have been testing this in the last days and by my tests, it's more visible with the hooks "always", "ms100" and "second", since they are called very frequently. It happens even if there is no code inside the hooked functions. I suppose this affects all hooks, however it's not so visible because they are not called so frequently. The RAM usage grows slowly by 4KB, and keeps going, after 24 hours of uptime (or less), the server will be using 100 MB, 200 MB or even more of RAM.

A very easy way to test this and see it by yourself is by taking CS2D Dedicated Server 0.1.2.5, setting the map to de_cs2d and filling it with bots (because bots are Lua), notice how the RAM usage stays normal. Now do the same thing in 1.0.0.1 and watch as how the RAM usage keeps going up and up, non-stop. It will eventually reach 100 MB, 200 MB, 300 MB and so on RAM usage. It happens both on Windows and Linux (by my tests). It's unacceptable, especially on a VPS where more than 1 server is being hosted on. You can also test this by using scripts that use the hooks "always", "ms100" and "second", especially "always".

And apparently it also happens not only with hooks, but with functions too, like player(0, "table") (being called very frequently).

I said 0.1.2.5 because that's the version before DC added LuaJIT (in 0.1.2.6), he then removed it in 0.1.2.7 (I tested on it as well, the same memory leaks happened). From what I see it's where the memory leaks started.

It personally pisses me off because it forces me to change code which is right, using timers and other workarounds where they shouldn't be necessary. I hope this gets fixed in the next version.
edited 5×, last 03.12.15 06:07:12 pm

old Re: CS2D Bug Reports

BCG2000
User Off Offline

Quote
From what I remember, it still keeps going up. That's also why I said it's a memory leak, the RAM usage keeps going up, the allocated memory is never freed again (unless I shut down the server process). I remember one time where I left my server online for like 1 and half day, then when I checked it (Linux), it was using like 400+ MB RAM, and I had changed map a few times on it.

Also it has nothing to do with my code, like I said, it happens even if there is no code inside the hook (very visible with the hook "always"). And when I don't use any Lua scripts (no bots either because they are Lua too), the RAM usage stays normal (at 6~7 MB RAM).

And there is another bug which is probably related to this, when I do "rcon fps" on the console it says 0 FPS even though the server is running at 50 FPS (only happened on Linux for me, even without any Lua script being used).
edited 3×, last 03.12.15 07:04:31 pm

old About leaks

Pagyra
User Off Offline

Quote
user KINGGOLDrus has written
Unfortunately, the game has many memory leaks

After game launching and quitting:
1
2
3
4
5
6
7
8
9
10
11
12
13
ERRORS FOUND:
      0 unique,     0 total unaddressable access(es)
    395 unique, 30680 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total warning(s)
     42 unique,    76 total,  40508 byte(s) of leak(s)
    161 unique,  1084 total, 4225236 byte(s) of possible leak(s)

ERRORS IGNORED:
    373 potential error(s) (suspected false positives)
    627 potential leak(s) (suspected false positives)
    142 unique,   393 total, 488337 byte(s) of still-reachable allocation(s)

After map loading and quitting:
1
2
3
4
5
6
7
8
9
10
11
12
13
ERRORS FOUND:
      0 unique,     0 total unaddressable access(es)
    722 unique, 56294 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total warning(s)
     40 unique,    46 total,  32924 byte(s) of leak(s)
    215 unique,  1208 total, 36385615 byte(s) of possible leak(s)

ERRORS IGNORED:
    685 potential error(s) (suspected false positives)
    599 potential leak(s) (suspected false positives)
    534 unique,  1284 total, 1009400 byte(s) of still-reachable allocation(s)

old Re: CS2D Bug Reports

BCG2000
User Off Offline

Quote
I think the client always had that, not sure. You can always just close and open it again, after all you never leave it open 24/7, you only use it when you play the game.

But I was talking about the dedicated server, for me that's more serious, and it's not always practical to close and open it. Because it's something that you usually leave online 24/7... It didn't have these memory leaks in previous versions from what I can see.

EDIT: Seeing that the post is from 2015 too, the memory leak on the client is probably related to the Lua module too, I didn't realize it before. So maybe what I said above about the client is wrong. But on the dedicated server, it's very clear that it has memory leaks, and they should really be fixed.
edited 5×, last 04.12.15 03:14:07 pm

old Re: CS2D Bug Reports

GeoB99
Moderator Off Offline

Quote
IMG:https://i.imgur.com/2PccpeN.png

This looks like a typo. There shouldn't be a "z" in the end of the word.

old Re: CS2D Bug Reports

Yates
Reviewer Off Offline

Quote
So when is killing a dead player going to be fixed?

It still crashes the server

old Re: CS2D Bug Reports

GeoB99
Moderator Off Offline

Quote
I do notice the "Friends" notification bug in main menu it is still there and not fixed yet.

old Re: CS2D Bug Reports

Yates
Reviewer Off Offline

Quote
I use parse("killplayer "..id), not sure if that makes any difference. When I try to use killplayer on a dead person this crashes my dedicated server. When I am the server (new game) this doesn't happen.

old Re: CS2D Bug Reports

Mami Tomoe
User Off Offline

Quote
kill *id* in lua works but will return a error saying the command does not exist (will still kill the player)

i know about killplayer but still

old Re: CS2D Bug Reports

DC
Admin Off Offline

Quote
@user Mami Tomoe: See cs2d cmd kill. It's only for suicide. It doesn't expect any parameters at all. I assume you tried to kill player 1 (yourself in most test scenarios) so that's why it worked.

old Re: CS2D Bug Reports

Mami Tomoe
User Off Offline

Quote
@user DC: actually as i remember i think it killed everyone i tried it on (not only me)

but ill try again and tell u if it still works

EDIT:
nvm it will only work on me
still weird that it will return a missing command error
(happens the same when u restart the round while its being restarted)

old Re: CS2D Bug Reports

DC
Admin Off Offline

Quote
@user Mami Tomoe: It's printing that error because it tries to parse the parameter as a new command as it doesn't expect any parameter at that place. So if you type something like
1
kill 4
it will parse "kill" in the first step. Afterwards it sees that there's a " 4" left which can't be part of "kill". Therefore it tries to find a command called "4" - which does not exist.

Yes, "CS2D-Script" is very primitive

You can even do this:
1
2
alias "4" "echo lol"
kill 4
result: you will commit suicide and the console will say "lol"
To the start Previous 1 233 34 35102 103 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview