0

I am using different methods for different programs to control their resource management. When I used systemd-run for gimp(GNU image manipulation program), when picture's memory requirement is higher than limit(i.e. 300MB which I set), program crashed and closed. Is there any systemd-run method which provides both using it safely without crashing and limiting its memory to a limit?

I used below command to start it with systemd-run in its shortcut (i.e. its desktop file ) :

systemd-run --scope -p MemoryLimit=300M gimp-2.8 %U
1
  • The program can't work with the amount of memory you're willing to give it. You cannot have your cake and eat it at the same time! Commented Mar 17, 2022 at 18:40

1 Answer 1

0

A program, such as gimp, is compiled, with all its behaviors preset. If it is unable to allocate memory for itself, then it won't be able to run any tasks. Any time that the program tries to access memory it can't, it must exit(with a segmentation fault), as the the program expected to have that memory to run, for example in the case of gimp, to store an image.

Of course, that image could be stored with less ram, but that isn't in gimp's code, and just refusing gimp access to memory won't make it more efficient.

A good solution if you have issues with low memory is a swapfile. This will not limit your program's access to memory, which will break it, but instead store unused memory to disk(instead of on the RAM), and pulling it back off the disk when in needs to be used.

0

You must log in to answer this question.