Memory Leak in Trigger(Server/Client)Event()?

GTA V version?
Everything up to date

Legit or Pirate copy?
legit

Steam/CD/Social Club?
Steam

Windows version?
Windows 10 Pro

Did you try to delete caches.xml and try again?
Yes

System specifications
i5-6600 @3.3GHz
16GB RAM
Zotac GTX 1080 Amp Extreme

What did you do to get this issue?
Client triggers a ServerEvent which triggers another ClientEvent

What server did you get this issue on?
My own testserver but it also happens on our liveserver (just was never seen until the latest update which introduced the resmon

What exactly happens:
I developed a script for our server which is mainly for syncing vehicles with the server.
It is not optimized as of now but while optimizing I found a weird issue with triggering events.

The client gets all informations from a vehicle once when exiting that vehicle and saves everything in an array (like engine health, position and so on). This array then gets send to the server by using TriggerServerEvent(). The server then manages all the information and depending on the ownership of the car this information has to be sent back to the owner of the vehicle via a TriggerClientEvent(). To make it easier and to make sure he gets everything I send ALL vehicles back to that client, which of course is a lot (actually way too much) of data.

Example: Client sends data -> server processes -> server sends back more data -> client receives this data but it NEVER leaves the memory

RegisterNetEvent('AdvancedParking:receiveAllVehicles')
AddEventHandler('AdvancedParking:receiveAllVehicles', function(_allVehicles)
    [...]
end)

_allVehicles is usually around 3MB of data on our liveserver (which is way too much, I know), but everytime this event gets triggered (even if the event is empty!), it adds the 3MB to the memory usage but it never releases them. As if the lua garbagecollector never grabs it.

I narrowed it down as far as I could… and the only thing left are the events happening.

Our server i getting a major update nonetheless with a lot of custom scripts and of course we want to optimize as much as we can, but this just confuses me D:

Feel free to ask if you didn’t get something I said here xD

Do you happen to have a minimal repro for this happening, even if it’s sending ‘random’ data?

Sure, although I gotta go to work now. I’ll send something later this day!

Well okay… I’ll take my issue back… maybe there is still a kink in my code…

I made a test script:

memoryleaktest.rar (794 Bytes)

… and I could not reproduce the problem, but I found something else you probably should take a look at. Made a small video showing really weird behaviour regarding memory usage:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.