excelize-wasm icon indicating copy to clipboard operation
excelize-wasm copied to clipboard

memory running out

Open spearmootz opened this issue 2 years ago • 3 comments

hello,

i am running node with 4GB of memory.

when i create an excel containing around 64k records with 58 columns of uuids i run out of memory.

i tried to play with the importObject and added mem, and memory into various keys but it didnt work :( otherwise i would be making a PR

exports: {
    mem: new WebAssembly.Memory({ initial: 100, maximum: 62500, shared: true }),
    memory: new WebAssembly.Memory({
      initial: 100,
      maximum: 62500,
      shared: true,
    }),
  },
  env: {
    memory: new WebAssembly.Memory({
      initial: 100,
      maximum: 62500,
      shared: true,
    }),
    mem: new WebAssembly.Memory({ initial: 100, maximum: 62500, shared: true }),
  },
  js: {
    mem: new WebAssembly.Memory({ initial: 100, maximum: 62500, shared: true }),
    memory: new WebAssembly.Memory({
      initial: 100,
      maximum: 62500,
      shared: true,
    }),
  },
  go: {
    memory: new WebAssembly.Memory({
      initial: 100,
      maximum: 62500,
      shared: true,
    }),
    mem: new WebAssembly.Memory({ initial: 100, maximum: 62500, shared: true }),

spearmootz avatar May 17 '23 01:05 spearmootz

Thanks for your feedback. I will investigate this problem recently.

xuri avatar May 17 '23 02:05 xuri

@xuri i tried a lot of things.

i also tried to do

i.instance.exports.mem.grow(65000)

and that made it a ton faster, i assume because it had less memory grow events per say. but it reaches the exact same point. now that point is way less than 4GB (which is the maximum memory any wasm program can take at this time since its 32 bit). based on my intuition and what i read, i saw that for example when you compile rust to wasm you can specify to wasm that i can take more space. i researched how to do this in go but i did not find the answer. i hope this helps :(

spearmootz avatar May 17 '23 17:05 spearmootz

@xuri for reference https://github.com/rustwasm/wasm-bindgen/issues/2498#issuecomment-801494135

spearmootz avatar May 17 '23 17:05 spearmootz