On Fri, Feb 07, 2025 at 03:37:31AM +0100, Christian Schulte wrote: > Hi @misc, > > does OpenBSD provide something equivalent to Linux' malloc_trim(3)[1]? I > am yet to port an application from Linux to OpenBSD and that application > is making use of malloc_trim(3). I removed the calls to malloc_trim(3) > from that application while still running on Linux and it seems it > really needs to perform those calls there in order to release memory to > the OS after having run for a couple of weeks without restart. That > application is using pthreads(7)[2] a lot but this is not the issue. > Even if it would fork/execve, those processes also would not get > terminated up until the whole application is terminated. > > [1] <https://man7.org/linux/man-pages/man3/malloc_trim.3.html> > [2] <https://man7.org/linux/man-pages/man7/pthreads.7.html> > > -- > Christian >
No all mallocs are created the same. OpenBSD's malloc does release memory back to the OS automatically. It's even quite aggressive in that respect. So just don't worry. I do not understand your last two sentences. -Otto