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

Run plugin: add memory limit #1226

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

Run plugin: add memory limit #1226

wants to merge 16 commits into from

Conversation

Akuli
Copy link
Owner

@Akuli Akuli commented Dec 16, 2022

On linux, it's annoying when my dumb program allocates so much memory that the entire computer freezes. This is because linux decides that it's a good idea to use swap for more memory. Swap basically means using the hard drive as if it was RAM, and that's really really slow.

To help with this, add a setting that limits how much memory the program can allocate. The setting shows up in the run dialog, but it's saved to Porcupine's settings so that it won't change if you run a different command.

@Akuli
Copy link
Owner Author

Akuli commented Dec 17, 2022

This might not be a great idea, because if I understand the preexec_fn warning in docs correctly, it can freeze Porcupine even when we don't run out of memory.

@Akuli
Copy link
Owner Author

Akuli commented Dec 21, 2022

I have a better idea for implementing a memory limit, but it will require some changes.

First, we should change no_terminal.py so that it uses bash_run.sh (except on Windows, of course). Currently bash_run.sh is invoked only when a command is ran in an external terminal.

Once that is done we can simply add a ulimit command to bash_run.sh, although it will need to take a parameter describing what memory usage to apply. It already takes one parameter indicating whether to wait for user's enter press once the command is done.

@Moosems
Copy link
Contributor

Moosems commented May 16, 2023

Personally I think the idea of swap for RAM that's not used as often is kinda smart, I just feel like it could be implemented a bit better.

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.

2 participants