[SOLVED] macOS VM_SWAPUSAGE lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- trev · 2019-06-22 07:21 In Delphi I used: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure SwapUsage;type swapinfo = record    xsu_total    : Int64;    xsu_avail    : Int64;    xsu_used     : Int64;    xsu_pagesize : Integer;    xsu_encrypted: Boolean;end; var  mib : array[0..1] of Integer;  status : Integer;  len : size_t;  swap : swapinfo;begin  FillChar(swap, sizeof(swap), 0);  mib[0] := CTL_VM;  mib[1] := VM_SWAPUSAGE;  len := sizeof(swap);  status := SysCtl(@mib, Length(mib), @swap, @len, nil, 0);  if status <> 0 then RaiseLastOSError;   SwapTotal := (swap.xsu_total /1024 /1024);  SwapAvail := (swap.xsu_avail /1024 /1024);  SwapUsed :=  (swap.xsu_used /1024 /1024);  SwapPageSize := swap.xsu_pagesize;  if(swap.xsu_encrypted = true) then    SwapEncrypted := 'Yes' else SwapEncrypted := 'No';end; to determine swap stats. At the command line 'sysctl vm.swapusage' returns:   vm.swapusage: total = 1024.00M  used = 191.00M  free = 833.00M  (encrypted) which is what the above code does. Unfortunately, compiling it  with Lazarus (after changing SysCtl to fpSysCtl) returns the error: VM_SWAPUSAGE identifier not found Any ideas? (yes I have the SysCtl unit included) ---------------------------------------------------------------------- lucamar · 2019-06-22 08:04 Sounds like VM_SWAPUSAGE is not declared anywhere. It's just an integer, isn't it? You can copy the value over from Delphi or from Apple's docs/headers. ---------------------------------------------------------------------- trev · 2019-06-22 09:21 Perfect: const VM_SWAPUSAGE = 5; Thanks! ---------------------------------------------------------------------- lucamar · 2019-06-22 10:38 Glad it helped