RFR (S) 8221325: Add information about swap space to print_memory_info() on MacOS

Thomas Stüfe thomas.stuefe at gmail.com
Mon Mar 25 15:21:34 UTC 2019

Hi Ralf,

you are worried that xsw_usage on your compile machine differs from what is
encountered at runtime?

In that case you should hande sysctlbyname returning != 0 and ENOMEM since

(freebsd man sysctlbyname(3))

"If the amount of data available is greater than the size of the buffer
supplied, the  call supplies as much data as fits in the buffer provided
and returns with the error code ENOMEM."

which would cover the case of old build machine vs newer runtime machine
with a larger xsw_usage struct.

On the other hand, since xsw_usage is nowadays defined like this:

struct xsw_usage {

u_int64_t xsu_total;
u_int64_t xsu_avail;
u_int64_t xsu_used;
u_int32_t xsu_pagesize;
boolean_t xsu_encrypted;

it would be strange if it were on older machines < offsetof(xsu_used).
Would be a very small structure.

Was that a theoretical precaution or did you see real issues?


On Mon, Mar 25, 2019 at 3:45 PM Schmelter, Ralf <ralf.schmelter at sap.com>

> Hi,
> please review this small change, which adds information about the swap
> space usage on MacOS to the output of print_memory_info(). This information
> was already present for other operating systems like Linux or AIX.
> webrev: http://cr.openjdk.java.net/~rschmelter/webrevs/8221325/
> bugreport: https://bugs.openjdk.java.net/browse/JDK-8221325
> Best regards,
> Ralf

More information about the hotspot-runtime-dev mailing list