Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions for swapfile, and let Node use it #120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

alexrudd2
Copy link
Owner

Closes #118

@alexrudd2 alexrudd2 requested a review from jedahan November 27, 2023 15:56
@alexrudd2
Copy link
Owner Author

@osresearch

@alexrudd2
Copy link
Owner Author

Damn it Windows. Probably worth using cross-env since I imagine the other envvars are broken as well?

alexrudd2 and others added 2 commits November 27, 2023 10:25
@alexrudd2
Copy link
Owner Author

@lewi0622 I noticed on your blog (cool!) that you were working around Out-of-Memory issues. Can you try this and see if it helps?

@lewi0622
Copy link

@lewi0622 I noticed on your blog (cool!) that you were working around Out-of-Memory issues. Can you try this and see if it helps?

I have a 5.1 megabyte file that reliably makes Saxi run out of memory when I plot all three layers. It handles plotting two layers fine.

I guess I'm a little confused exactly what to do. So my RPi3 already has a swap file created (not my explicit doing). Do I need to make another one? And do I need to do anything to allow Node to use it?

The below memory stats are when Saxi isn't running (when it is running, but not plotting, the used Mem goes up to 75M):
lewi0622@axipi:~ $ free -h --si
total used free shared buff/cache available
Mem: 921M 54M 521M 0.0K 345M 802M
Swap: 99M 15M 84M

@alexrudd2
Copy link
Owner Author

My (imperfect) understanding is there are/were two problems with memory. First, RPi Zeros only have 512MB RAM and can benefit from a swapfile. Since your RPi3 (1) has more memory and (2) already have a swapfile, this is of no use.

Second, this PR also uses a flag to give Node.js more memory than the default 512MB. See https://stackoverflow.com/a/62650303. Namely, --max-old-space-size=1024 (1GB). Can you try running saxi with that flag and see if that changes anything?

@lewi0622
Copy link

I did try with --max-old-space-size=1024 as well as values with 2048, and 3072 (4096 is too much for my RPi3, and fails the build step). I don't know how to tell if it's even trying to use the swap file.

With the attached file, even just running on the main branch, plotting two of the three layers is fine (approx. 14 hrs of plot time), but doing all three layers is too much (approx. 22 hrs of plot time) even with dedicating 3072 (3GB). Each layer of the file is of similar size/complexity.

So it's hard to say for sure, but increasing the --max-old-space-size doesn't seem to be helping in this case?

Cat_Flows_seed_121924_colors_9_scale_1_P_deC

@alexrudd2
Copy link
Owner Author

Damn. Well, it was worth a shot. :)

In the coming weeks I'm bringing in a colleague to hack on this a bit more. Perhaps we can try your test file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Out of memory on Pi Zero W (512 MB) Memory leak / OOM on RPi 4 with large plots
2 participants