Skip to content

Commit

Permalink
cleanup; 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zfdang committed Jan 2, 2024
1 parent ee6f6d0 commit e8fc17a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

PKG = free-for-macos
VER = 1.1.0
VER = 1.2.0

CWD = $(shell pwd)
PREFIX ?= /usr/local
Expand Down
9 changes: 1 addition & 8 deletions free.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <libgen.h>
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <mach/kern_return.h>
#include <mach/host_info.h>
#include <mach/host_priv.h>
#include <sys/types.h>
#include <sys/sysctl.h>

#include "free.h"
Expand Down Expand Up @@ -167,7 +160,7 @@ int main(int argc, char **argv) {
formatBytes(vm_stat.wire_count * page_size, mem.wired, sizeof(mem.wired), human);
// cached file = purgeable_count + external_page_count; verified
formatBytes((vm_stat.purgeable_count + vm_stat.external_page_count) * page_size, mem.cached, sizeof(mem.cached), human);
// truely-free = free-count - speculative_count
// truely-free = free_count - speculative_count
// used = total - truely-free - cached; partially verified, still small discrepancy
formatBytes(hbi.max_mem - (vm_stat.free_count - vm_stat.speculative_count + vm_stat.purgeable_count + vm_stat.external_page_count) * page_size, mem.used, sizeof(mem.used), human);
// app memory = internal_page_count - purgeable_count; verified
Expand Down

0 comments on commit e8fc17a

Please sign in to comment.