Skip to content
This repository has been archived by the owner on Dec 6, 2020. It is now read-only.

Out of memory #24

Closed
dqrkk opened this issue May 27, 2020 · 1 comment
Closed

Out of memory #24

dqrkk opened this issue May 27, 2020 · 1 comment

Comments

@dqrkk
Copy link
Contributor

dqrkk commented May 27, 2020

Hi,

I run a server with 2GB ram, when papyrusjs generate zoom level for my map, the process is killed.
The world is 22MB.
In syslog file, it shows:

Out of memory: Kill process 27511 (node) score 861 or sacrifice child
May 27 10:22:09 vps-01745824 kernel: [246841.076866] Killed process 27511 (node) total-vm:2494560kB, anon-rss:1710500kB, file-rss:0kB, shmem-rss:0kB

I found the solution to this problem:
1/ Add these lines in renderZoomLevel.js

diff --git a/render/renderZoomLevel.js b/render/renderZoomLevel.js
index 6e958f6..b3998d9 100644
--- a/render/renderZoomLevel.js
+++ b/render/renderZoomLevel.js
@@ -76,6 +76,8 @@ module.exports = function (chunkSize, zoomLevelMax, chunkX, chunkZ) {
                                     fs.mkdirSync(path.normalize(path_output + '/map/' + (zoomLevelCurrent) + '/' + (ix) + '/'));
                                 }
                                 tileImg.saveSync(path.normalize(path_output + '/map/' + (zoomLevelCurrent) + '/' + (ix) + '/' + (iz) + '.png'));
+                               tileImg = null;
+                               global.gc();
                                 resolve();
                             }
                             )

2/ Call node with arg: --expose-gc

With this setting, I ran map generation with no problem, using max 500MB memory
Warning! If node is not launched with --expose-gc, it will crash on this step.

@clvrk
Copy link
Member

clvrk commented May 27, 2020

Hey :)! Thanks, this looks promising, I will definitely test this out later!

Would you mind opening a pull request so I can possibly merge your changes?

@clvrk clvrk closed this as completed in 80719b9 Jun 17, 2020
clvrk added a commit that referenced this issue Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants