repeat-space/anki-apkg-export

Cannot enlarge memory arrays - Possible to modify sql.js file?

duffrind opened this issue · 2 comments

Hello,

I attempted to use anki-apkg-export to generate 861 cards, but am reaching the memory limit before they are all added.

The final apkg file is 87KB so I don't know why I am hitting the current ~18MB limit that sql.js has. Regardless, I am wondering if I would be able to either:

  • have anki-apkg-export use a custom sql.js that is compiled to have a TOTAL_MEMORY of 512MB

  • have anki-apkg-export use sql-memory-growth.js instead of sql.js without modifying the dist/index.js file directly

Enlarging the arrays adds overhead that doubles the execution time when compared to increasing the TOTAL_MEMORY, so I would prefer the first option.

I am new to nodejs so perhaps I am off-topic and this is possible with yarn scripts.

Thanks,
David

After searching around I realized that all I must do is append Module = { TOTAL_MEMORY: 536870912 }; to my js file before I require anki-apkg-export

ewnd9 commented

Hi, thanks for the valuable information, I put a link to this issue in README.

In regard of custom sql.js: take a look at https://github.com/ewnd9/anki-apkg-export/blob/master/src/index.js

You can require anki-apkg-export/dist/exporter and manually pass custom sql.js and an sql template to it.