openscopeproject / TrguiNG

Remote GUI for Transmission torrent daemon
GNU Affero General Public License v3.0
334 stars 39 forks source link

I think there is kind of memory leaks or something like that #146

Open Dukobpa3 opened 8 months ago

Dukobpa3 commented 8 months ago

TrguiNG been running couple days no closing and finally became laggy and glitchy until I've relaunched it

qu1ck commented 8 months ago

I am running it for weeks at a time on windows, no issues. Are you on mac? Do you use hide window feature or close?

Next time this happens check memory usage when window is opened and also when window is closed (not hidden). And if it fixes itself after window is closed and reopened. That will narrow it down to where the leak is, in frontend or backend, if there is one.

Dukobpa3 commented 8 months ago

Im not sure what is hide and what is close in this case I'm on mac, yes. I'm not using status bar(tray) icon. Window is always opened but mostly minimized in taskbar.

qu1ck commented 8 months ago

I was referring to this setting

image

But since you are not using tray icon you and just minimize the window your frontend is still running.

So to narrow the issue down enable the tray icon for now and next time you experience sluggishness check memory usage and try to close the frontend and reopen it (click tray icon -> hide and then open). If it's still sluggish then the issue is in the backend but it's unlikely.

Dukobpa3 commented 8 months ago

Ok Thought about it

Hiding and closing are different only by "icon from where to start next time" So hiding is actually the same as closing from my point of view.

And if opened/minimized app eats memory or cpu in progression while running – there is an issue.

qu1ck commented 8 months ago

You are not reading what I wrote, I'm not saying there is no issue, I'm giving you steps to help me narrow down where the issue might be. Because I don't use mac I can not investigate myself. This does not happen for me on Win or Linux or Mac VM (although I can't run my VM for weeks).

First you need to confirm that there is actually a memory leak, check memory usage in activity monitor app. Second, if there is a memory leak, narrow it down to if it happens in backend or frontend. Activity monitor should also help there since frontend process looks like "tauri://localhost" there. Third, if there is a memory leak and it's in frontend then you can verify if it's the app code leaking or if it's webkit's inefficiency. You can check in inspector tools by right clicking somewhere in details panel, choosing "Inspect element", then switching to "Timelines" tab, recording few seconds of data, navigating to "Memory" (you may have to enable memory profiling before recording to have that section visible). This is what healthy state should look like, give or take.

image

If your JavaScript section takes gigabytes then it would be leak in app code. If your page or other section takes gigabytes then it would be leak in webkit.

Hiding and closing are different only by "icon from where to start next time" So hiding is actually the same as closing from my point of view.

From user facing point of view they are the same. But as the hint explains, closing saves RAM significantly (think 300-500MB vs 20-30MB). And if it happens that there is a memory leak and it's not in app code but in webkit, then there would be nothing I could do and using that close option would be the only workaround.