Process memory goes on increasing in FreeBSD 13

Hello Team,

I am facing one issue in which process memory goes on increasing day by day. It starts with 150MB and reaches to 1.7GB with 2-3 days.There is no leak in code as same code works on Linux platform smoothly without any memory issue. I am freeing up all memory which is allocated by mmap or malloc call. Also, I searched on net FreeBSD OS cache the freed memory for optimization but there is no malloc_trim() like function available for FreeBSD 13.

Adjusting values of virtual memory and physical memory using setrlimit() also not helpful. Any idea how to solve this memory consumption issue?

struct rlimit rl;

// Setting virtual address space limit to 1 GB
rl.rlim_cur = 1024 * 1024 * 1024; // 1 GB
rl.rlim_max = 1024 * 1024 * 1024; // 1 GB

if (setrlimit(RLIMIT_AS, &rl) == -1) {
return 1;
}


// Setting physical address space limit to 1 GB
rl.rlim_cur = 400 * 1024 * 1024; // 400 MB
rl.rlim_max = 400 * 1024 * 1024; // 400 GB

if (setrlimit(RLIMIT_DATA, &rl) == -1) {
return 1;
}
 
Back
Top