limiting and dedicating memory/cpu usage

To see how much RAM memory your computer has, use dmesg|grep -i memory.

For limiting MEM usage of a user, which also limits the programs ran under it
/boot/loader.conf
Code:
kern.racct.enable="1"
This must be compiled into the kernel, if it's not already there.

For myusername, use your user or any other group listed in /etc/group:
rctl -a user:myusername:memoryuse:deny=3840K
Also, enter this exact line into /etc/rctl.conf. deny says the max amount that can be used by this user. See https://klarasystems.com/articles/controlling-resource-limits-with-rctl-in-freebsd/.


For dedicating an amount of RAM memory to kernel
/etc/sysctl.conf
Code:
hw.physmem=512K
Also, use this on the command line with sysctl to make it take effect immediately. To see set values, use sysctl -a with | grep. See, sysctl(3) for details.


Need more ways of limiting/dedicating RAM and memory usage
On my computer, Firefox often causes FreeBSD to freeze up, and I can't get out without shutting off the computer. Hopefully, the above help.

To find the WM class of desktop programs, use xprop|grep -i class. Could use some help on using this WM class to restrict RAM/CPU usage for these programs. Then, may need to look at limits(1).

 
choose a unique UID from 50 to 999 and register it in ports/UIDs (for users) and ports/GIDs (for groups). The unique identification should be the same for users and groups.
Please include a patch against these two files when requiring a new user or group to be created for the port.
Then use USERS and GROUPS in Makefile, and the user will be automatically created when installing the port.
USERS= pulse
GROUPS= pulse pulse-access pulse-rt
The current list of reserved UIDs and GIDs can be found in ports/UIDs and ports/GIDs.
/usr/ports/Mk/bsd.gecko.mk
Code:
# This file contains some reusable components for mozilla ports. It's of
# use primarily to apps from the mozilla project itself (such as Firefox,
# Thunderbird, etc.), and probably won't be of use for gecko-based ports
# like epiphany, galeon, etc.
Perhaps adjusting Thunderbird's and Firefox's Makefile to group them as a new group of Gecko, then testing and submitting that to a bug report. Then RAM allocation can be better refined for Firefox and Thunderbird together.
 
Laptop.Toshiba Intel Pentium. It's over 10 years old.

IIRC, my more modern desktop which was an older Ryzen, crashed too, and I had to use the power switch. It didn't freeze up as badly, and got into runaway processes.
 
Back
Top