On Tue, 17 Mar 2026 17:41:22 GMT, Harald Eilertsen <[email protected]> wrote:

>> make/autoconf/build-performance.m4 line 84:
>> 
>>> 82:       if test "$MEMORY_SIZE" -gt "$RLIMIT_DATA"; then
>>> 83:         MEMORY_SIZE=$RLIMIT_DATA
>>> 84:       fi
>> 
>> Curious, why only OpenBSD? This looks like it should be valid for all BSDs 
>> or even for all Unices.
>> 
>> It may depend on how and where the libc allocates memory for malloc, I 
>> guess? Is that different for the various BSDs?
>
> Not sure tbh, @bsdkurt or @battleblow may know more.

I can comment as to why this came about for OpenBSD. OpenBSD default limits are 
generally much lower than other OSs. What was happening is that configure would 
set memory usage based on physmem but with OpenBSD's lower default data rlimit 
that would be too high when the build machine had significantly more physmem 
then the rlimit data size and would cause the jvm to fail.

man getrlimit(2) excerpt from OpenBSD: 

     RLIMIT_DATA     The maximum size (in bytes) of the data segment for a
                     process; this includes memory allocated via malloc(3) and
                     all other anonymous memory mapped via mmap(2).

whereas on FreeBSD it does not appear to include anonymous mmap memory:

RLIMIT_DATA     The  maximum  size (in bytes) of        the data segment for a
                       process; this defines how far a program may extend  its
                       break with the sbrk(2)

I suppose for FreeBSD `RLIMIT_AS` may make sense:

       RLIMIT_AS       The maximum amount (in bytes)  of  virtual  memory  the
                       process is allowed to map.

-------------

PR Review Comment: 
https://git.openjdk.org/bsd-port/pull/4#discussion_r2949260536

Reply via email to