Linked Questions

36
votes
7answers
35k views

Is there a way to limit the amount of memory a particular process can use in Unix? [duplicate]

I need to test a process for memory management. I do not have the source, so I need to do all the testing from the OS side. I want to be able to say something like limitmemory 400k -p <pid> Is ...
11
votes
2answers
23k views

How to limit available virtual memory per process [duplicate]

Occasionally some processes on my GNU/Linux desktop (such as gv and gnash) use up the physical memory and cause thrashing. Since these processes aren't important, I want them to be automatically ...
2
votes
1answer
766 views

Memory Usage in Linux [duplicate]

How to setup limit for process to memory usage? Similar to open files limit in /etc/security/limits.conf: ubuntu soft nofile 4096 ubuntu hard nofile 8192 ...
1
vote
1answer
253 views

Restricting CPU memory usage for services to prevent a crash [duplicate]

I'm running a Ubuntu VM with an 8 GB RAM with docker containers ( 8 GB is just about enough for my requirements) but at some point the VM freezes/crashes due to memory exhaustion leaving me no choice ...
1
vote
0answers
54 views

Set memory allocation for applications in Ubuntu [duplicate]

I have an application running under Ubuntu that tries to consume all available memory. Is there a way to specify and restrict the allocations available for a given application?
0
votes
0answers
48 views

Execute command with memory constrains [duplicate]

I routinely perform numerical computations in my laptop, using programs that I write myself in Python, Julia, C++, etc. I am not a perfect programmer (far from it), and I make coding errors frequently....
19
votes
4answers
6k views

bash -e exits when let or expr evaluates to 0

I have a bash script that sets -e so the script will exit on any exit status != 0. I'm trying to do some basic shell arithmetic assigned to variables and sometimes the expression equals 0 which ...
10
votes
1answer
4k views

Does 'ulimit -m' not work on (modern) Linux?

This article claims that the -m flag to ulimit does nothing in modern Linux. I can find nothing else to corroborate this claim. Is it accurate? You may try to limit the memory usage of a process ...
10
votes
1answer
5k views

SSH server always available under heavy load

Is there a way my SSH server, and everything under it (including bash) can be always available under heavy load ? Maybe it could be some kind of a critical path, all in memory, with a dedicated CPU ...
10
votes
2answers
2k views

How to solve this memory issue gracefully?

I have a standard Linux (Debian testing) laptop, with a swap partition. I do a lot of experiments with it. Some of them are really memory hungry and the way Linux behaves by default is an issue for ...
0
votes
1answer
2k views

Cannot set memory.memsw.limit_in_bytes in cgroup on Ubuntu server using cgm

I'm trying to limit resource usage for a cgroup without having root access. I can set memory.limit_in_bytes using cgm setvalue memory memory.limit_in_bytes 150G But I can not set memsw....
2
votes
1answer
484 views

Can I deny use of swap space to a specific process (and have it just get killed)?

While developing some software, a program under test sometimes eats all the memory, then proceeds to yomp into the swap space and start thrashing the disk, leading to a predictable drop in ...
0
votes
1answer
449 views

Shell-script to periodically free some memory up with Ubuntu 18.10 LiveCD with only 4GB of RAM. Need some improvement

Edit 1: The freezing just happened and I was able recover from it. Log(syslog) from the freezing until 'now': https://ufile.io/ivred Edit 2: It seems a bug/problem with GDM3. I'll try Xubuntu. Edit ...
0
votes
2answers
371 views

How to limit a process' memory usage while it is running?

On my server, I have a long running batch process, process_a, which have been running for several days now. I don't mind the duration of which the process needs. The problem is how process_a always ...
1
vote
1answer
130 views

What does `swapaccount=1` in GRUB_CMDLINE_LINUX_DEFAULT do?

In the question Limit memory usage for a single Linux process it was mentioned to change the file /etc/default/grub so that GRUB_CMDLINE_LINUX_DEFAULT contains GRUB_CMDLINE_LINUX_DEFAULT="...

15 30 50 per page