Skip to content
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

Client side memory leak #140

Open
xxshady opened this issue Apr 14, 2022 · 12 comments
Open

Client side memory leak #140

xxshady opened this issue Apr 14, 2022 · 12 comments
Labels
type: bug Something isn't working

Comments

@xxshady
Copy link
Contributor

xxshady commented Apr 14, 2022

Description of the problem

Reproduction steps

Reproduction steps

  1. Check heap size in console
    image

  2. reconnect

  3. Check heap size in console again
    image

Expected behaviour

No memory leak!!

Additional context

No response

Operating system

Windows 11

Version

dev/10.0-dev12

Scope

client

@xxshady xxshady added the type: bug Something isn't working label Apr 14, 2022
@LeonMrBonnie
Copy link
Contributor

It's nothing new that Client JS is full of memory leaks and unfortunately they are very hard to track down

@Stuyk
Copy link

Stuyk commented Apr 14, 2022

Step 2. Reconnect

Well there's your problem.

@xxshady
Copy link
Contributor Author

xxshady commented Apr 14, 2022

Step 2. Reconnect

Well there's your problem.

@Stuyk what do you mean?

@Stuyk
Copy link

Stuyk commented Apr 14, 2022

alt:V was never written with the intention of cleanup after reconnect. Yes it's a nice to have thing but there are certain things which cannot be cleaned up during the reconnection process. The code was written to be most performant during a single connection and a game reboot would be required to get that same performance on other servers.

@xxshady
Copy link
Contributor Author

xxshady commented Apr 14, 2022

Its not about cleanup, its a memory leak in js module, that can be fixed (and yes, Leon already has replied that this is not an easy fix).

And yes I know that reconnect (resource restart) is only for development (ofc you cant use it without debug mode xd)

@xxshady
Copy link
Contributor Author

xxshady commented Apr 14, 2022

Fix of this issue can improve js development experience on alt:V, nothing more

@xxshady
Copy link
Contributor Author

xxshady commented Apr 14, 2022

if you have gamemode that eats 100mb of the heap on first resource start and if you do 10-20 reconnects (resource restarts) your game will freeze on each resource start every reconnect for 5 or more seconds because of the heap overflow

@JustCup
Copy link
Contributor

JustCup commented Apr 14, 2022

I also noticed this when I tested my server, GTA even crashed :(

@LeonMrBonnie
Copy link
Contributor

For an "easy" fix we could maybe just "restart" the script runtime on reconnect, so that it creates a new isolate on every reconnect. This would definitely fix all memory leaks (at least those originating from JS objects... xd) but I don't know whether that will fuck other shit up

@xxshady
Copy link
Contributor Author

xxshady commented Apr 14, 2022

and if this fix turns out to be possible, resource restart will be overboard?

@LeonMrBonnie
Copy link
Contributor

I just pushed 6074731 which should definitely fix some memory leaks that existed before, someone can benchmark it to find out whether this improved anything

@Iamproplayer7
Copy link

i saw that, if u connect to the same server but without resources, it takes time to load resource but there no resources.
if u connect server, turn off server, turn on server without resources, reconnect to the server, it's need time to load resources that not exists, maybe there is memory leak, because old resource still in memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants