HashLips / hashlips_art_engine

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
MIT License
7.16k stars 4.3k forks source link

Error: out of memory - but I have got 40 GB of ram #1403

Open Megalithic1990 opened 1 year ago

Megalithic1990 commented 1 year ago

When I tried this art generator 5 months ago, everything was smooth.

Rebooting this project today, I had to deal with a huge amount of errors. Understandable. I got to fix all of them but this error below is killing me.

When building VS code only uses about 500mb of ram and total computer memory usage is around 1.5 GB. I have around 40 GB of ram. I don't get what to do. I tried running it from windows terminal, CMD, powershell. Same error. Thought I would try it on a weaker laptop but same error.

Can anyone help me solve this issue?

Error: out of memory at setSource (C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\node_modules\canvas\lib\image.js:91:13) at Image.set (C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\node_modules\canvas\lib\image.js:62:9) at C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\node_modules\canvas\index.js:34:15 at new Promise () at loadImage (C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\node_modules\canvas\index.js:23:10) at C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\src\main.js:185:27 at new Promise () at loadLayerImg (C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\src\main.js:184:12) at C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6\src\main.js:368:31 at Array.forEach ()

bolshoytoster commented 1 year ago

@Megalithic1990 you could try running node with --max-old-space-size=4096, where 4096 is the memory limit to give node in MB (by default it's only ~2GB).

Megalithic1990 commented 1 year ago

Forgive me, I am an absolute noob when it comes to such advanced level programming. I tried to use the you gave like the following

node --max-old-space-size=4096

When I use that, I get the following C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6>node --max-old-space-size=4096 Welcome to Node.js v16.17.1. Type ".help" for more information.

.help .break Sometimes you get stuck, this gets you out .clear Alias for .break .editor Enter editor mode .exit Exit the REPL .help Print this help message .load Load JS from a file into the REPL session .save Save all evaluated commands in this REPL session to a file

Press Ctrl+C to abort current expression, Ctrl+D to exit the REPL

When I use the following I get this - NODE_OPTIONS=--max-old-space-size=4096

C:\Users\User\Desktop\hashlips_art_engine-1.1.2_patch_v6>NODE_OPTIONS=--max-old-space-size=4096 'NODE_OPTIONS' is not recognized as an internal or external command, operable program or batch file.

What should I be doing?

bolshoytoster commented 1 year ago

@Megalithic1990 try running node --max-old-space-size=4096 index.js to run hashlips (you can also try increasing the 4096, it was just an example).

Megalithic1990 commented 1 year ago

@bolshoytoster So I tried with

node --max-old-space-size=16384 index.js

and I was aiming to make 7500. It fails at 150 generations and says Error out of memory.

bolshoytoster commented 1 year ago

@Megalithic1990 odd, you could try using my fork, which uses a lot less memory.

Megalithic1990 commented 1 year ago

@bolshoytoster Thank you for that suggestion. After trying it out I was able to find out the issue.

Apparently, there was a faulty image in one of my folders. It would be impossible to detect among so many other files. But using "my fork", it threw the same old "out of memory" error but only this time it was giving me a file name with its location. I removed the file and tried generating again in the original repo and it worked fine. Got to generate 7500 images without any issues.

You have saved my life. Thank you again for the quick responses.

bolshoytoster commented 1 year ago

@Megalithic1990 you're welcome.

using "my fork"

By "my fork", I meant it's the fork of hashlips that I own (basiically hashlips with my patches).

Megalithic1990 commented 1 year ago

@bolshoytoster Good thing you are around! haha. Cheers my friend.