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

Update Troubleshoot docs for Wails + Vite | Vite leaks memory in Windows #3903

Open
nich-frai opened this issue Nov 22, 2024 · 1 comment
Open
Labels
Enhancement New feature or request

Comments

@nich-frai
Copy link

nich-frai commented Nov 22, 2024

Is your feature request related to a problem? Please describe.

While developing Wails using Vite as a frontend dev server there's a memory leak / continuous CPU usage because of constant rescans of "./wailsjs/" folder;

Don't know if it's something related to Windows platform but in 10 mins ~ the app took 4gb of memory and if left overnight it took the whole 64gb of avaliable RAM;
There's a simple solution for it, since the Wails CLI will recompile / relaunch when a dependency from go is changes just add the "wailsjs" folder to the watcher exclude setting in vite;

Describe the solution you'd like

Add as part of the Troubleshooting section the following "vite.config.ts" update:

export default defineConfig({
  // ...
  server: {
    watch: {
      ignored: ["**/wailsjs/**"]
    }
  },
});

This prevents the leak / constant rescan of the folder by Vite;

Describe alternatives you've considered

Launching Vite by itself (no Wails dev) will NOT reproduce it!
The interaction of Wails + Vite managing/watching the same directory will cause this!

Additional context

I'm using windows, so the problem mught be related to the FS Watcher in this system especifically;
Will try to reproduce in Linux to see if it still occurs and post here!

It caused me to lose a day or so finding WHY was it leaking to the point I was accepting having to restart the proccess from time to time, so I thought it might save someone else's sanity posting the cause / solution of this specific problem.

@nich-frai nich-frai added the Enhancement New feature or request label Nov 22, 2024
@leaanthony
Copy link
Member

Thanks for reporting this. I suspect it's nothing to do with that specific file per se but more to do with the fact that it's getting regenerated and the watcher isn't cleaning up old file handles. You could try upgrading the underlying notify library and see if that fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants