On 2025-02-07, Otto Moerbeek <o...@drijf.net> wrote: > On Fri, Feb 07, 2025 at 11:16:05AM -0000, Stuart Henderson wrote: > >> On 2025-02-07, Daniel Wilkins <t...@linuxmail.org> wrote: >> > 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) >> >> -- >> >> Christian >> >> >> > Obvious question but: did you try just running it on OpenBSD? >> > "We didn't bother releasing the memory you freed because you might want >> > memory again" sounds like a Linux being stupid thing. >> >> If it's called from lots of places and hard to remove, find a good >> spot to put this: >> >> #define malloc_trim(p) ; >> >> -- >> Please keep replies on the mailing list. >> > > This might introduce unwanted changes, better leave out the semicolon > and return a value as malloc_trip() returns int. > > e.g > > if (malloc_trim()) > ... > > will break. This is better: > > #define malloc_trim(p) 1
Thanks. Good advice.