webui-dev / webui

Use any web browser or WebView as GUI, with your preferred language in the backend and modern web technologies in the frontend, all in a lightweight portable library.
https://webui.me
MIT License
2.96k stars 172 forks source link

Out of memory: Reached heap limit #274

Closed 7flash closed 10 months ago

7flash commented 10 months ago

image

7flash commented 10 months ago

This error prevents my app from running. If there is any way to increase the limit? I have enough RAM on my computer.

7flash commented 10 months ago

Probably should move this issue to webui-deno since these logs appears on backend, not frontend.

7flash commented 10 months ago

Because my backend is reading some files from local file system into memory before actually rendering web app

AlbertShown commented 10 months ago

It's hard to know what's going on without the logs. So, please replace the lib with the debug version one and share the logs.

7flash commented 10 months ago

I mean in this case it's pretty clear what's the issue, the question is how to resolve, how to increase memory limit in Deno.

async function loadFilesAsync(pathList: string[]): Promise<MemoryFiles> {
  const files = new Map();
  for (const path of pathList) {
    for await (const entry of Deno.readDir(path)) {
      if (entry.isFile) {
        const fileContent = await Deno.readFile(`${path}/${entry.name}`);
        console.log(entry.name, fileContent.length);
        files.set(entry.name, fileContent);
      }
    }
  }
  return files;
}

This is the way my script is reading lots of files to make sure frontend has access to them from memory.

AlbertShown commented 10 months ago

Why not simply use myWindow.show("/path/to/your/folder")?

hassandraga commented 10 months ago

I don't see any WebUI usage in the example. This issue is related to Deno-WebUI or Deno.