os: cgroup can set memory limits

This commit is contained in:
Mitchell Hashimoto
2024-06-04 21:02:25 -07:00
parent d351e80158
commit 01bfce0981
2 changed files with 37 additions and 0 deletions

View File

@@ -52,6 +52,15 @@ pub fn init(app: *App) ![]const u8 {
// I don't know a scenario where this fails yet.
try enableControllers(alloc, transient);
// Configure the "high" memory limit. This limit is used instead
// of "max" because it's a soft limit that can be exceeded and
// can be monitored by things like systemd-oomd to kill if needed,
// versus an instant hard kill.
// try internal_os.cgroup.configureMemoryLimit(transient, .{
// // 1GB
// .high = 1 * 1024 * 1024 * 1024,
// });
return transient;
}