-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak with TriggerClientEvent #3114
Comments
Are you both using the TriggerClientEvent frequently or transfering large data with it? |
@niCe86 I use it frequently |
That's a normal behavior when u stop the gc like u did in provided repro, u should call |
GC "stop" has absolutely nothing to do with it. It's in the example script solely for the purpose of having control over GC cycles and to demonstrate changes in garbage count. Without GC "stop" the result is the same - the memory leak does still occur. |
In my case i have no stop on the garbage collector. only count to log it, and collect. |
thats how gb works |
AGAIN. Garbage collector has nothing to do with this. |
Same Issue |
What happened?
When sending tables through TriggerClientEvent, memory is leaking. It is probably more noticeable with larger tables.
I'm using TriggerClientEvent a lot and my server RAM usage gradually increases from 500 MB to up to 10-15 GB at the end of the day (FXServer is being restarted daily).
Expected result
When sending table through TriggerClientEvent, allocated memory should be cleared.
Reproduction steps
collectgarbage('stop')
print(1, collectgarbage('count'))
local data = {}
for i = 1, 100000 do
data[i] = i
end
print(2, collectgarbage('count'))
for i = 1, 100 do
TriggerClientEvent("Test", playerid, data)
end
print(3, collectgarbage('count'))
data = nil
collectgarbage('collect')
print(4, collectgarbage('count'))
Importancy
Unknown
Area(s)
FXServer
Specific version(s)
Tested on FiveM artifact 12180 and 12651
I have confirmation from @IS4Code that on some ancient artifact from 2022 this doesn't occur
Additional information
The garbage collect clears all the garbage, but RAM usage won't decrease.
Example of my results:
[ script:wtls] 1 354979.76171875
[ script:wtls] 2 359075.85546875
[ script:wtls] 3 395079.3125
[ script:wtls] 4 350609.63769531
Example of actual RAM usage:
You can easily repeat the test script and the RAM will gradually increase. I have suspicion, that this memory leak might somehow degrade CPU performance as well?
The text was updated successfully, but these errors were encountered: