go/src
Michael Anthony Knyszek abf8e355a8 runtime: use MADV_FREE_REUSABLE on darwin
Currently on darwin we use MADV_FREE, which unfortunately doesn't result
in a change in the process's RSS until pages actually get kicked out,
which the OS is free to do lazily (e.g. until it finds itself under
memory pressure).

To remedy this, we instead use MADV_FREE_REUSABLE which has similar
semantics, except that it also sets a reusable bit on each page so the
process's RSS gets reported more accurately. The one caveat is for every
time we call MADV_FREE_REUSABLE on a region we must call MADV_FREE_REUSE
to keep the kernel's accounting updated.

Also, because this change requires adding new constants that only exist
on darwin, it splits mem_bsd.go into mem_bsd.go and mem_darwin.go.

Fixes #29844.

Change-Id: Idb6421698511138a430807bcbbd1516cd57557c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/159117
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-04 18:28:52 +00:00
..
archive archive/tar, syscall: add statUnix for aix/ppc64 2019-02-27 23:40:20 +00:00
bufio bufio: fix emptyFinalToken example to handle multiple Reads 2019-03-02 18:28:10 +00:00
builtin
bytes bytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial 2019-03-01 14:56:41 +00:00
cmd cmd/api: fix no go files package panic 2019-03-04 15:32:18 +00:00
compress compress/gzip: clarify that Multistream gzip requires a ByteReader 2019-02-26 23:02:40 +00:00
container container/heap: avoid memory leak in example 2019-02-26 23:42:26 +00:00
context
crypto internal/cpu: change s390x API to match x/sys/cpu 2019-02-28 13:46:45 +00:00
database/sql database/sql/driver: fix typo 2019-02-15 17:23:55 +00:00
debug debug/elf: perform stricter section header table checks in NewFile 2019-03-01 06:04:20 +00:00
encoding encoding/csv: document that Writer is buffered 2019-03-04 05:47:35 +00:00
errors errors: add Unwrap, Is, and As 2019-02-27 19:09:40 +00:00
expvar
flag
fmt fmt: fix %d and other non-string verbs on errors 2019-02-28 17:31:37 +00:00
go go/printer: add missing error checks in tests 2019-03-02 04:55:18 +00:00
hash
html html/template: prevent test from failing with nil pointer dereference 2019-03-02 01:53:40 +00:00
image image/png: delete unused statement 2019-02-28 18:24:51 +00:00
index/suffixarray
internal internal/poll: copy and use errnoErr to avoid allocations 2019-03-04 01:22:28 +00:00
io io: align style of test comments in multi_test.go 2019-02-26 23:01:20 +00:00
log
math math/big: better initial guess for nat.sqrt 2019-02-27 18:48:56 +00:00
mime
net net/http: make TimeoutHandler's ResponseWriter implement Pusher 2019-03-02 05:42:50 +00:00
os os/exec: less allocs in the common case 2019-03-04 09:45:46 +00:00
path path/filepath: do not call GetFinalPathNameByHandle from EvalSymlinks 2019-03-01 07:45:00 +00:00
plugin
reflect all: rename WebAssembly instructions according to spec changes 2019-03-03 21:10:01 +00:00
regexp regexp: add ReplaceAllStringFunc example 2019-02-27 21:48:41 +00:00
runtime runtime: use MADV_FREE_REUSABLE on darwin 2019-03-04 18:28:52 +00:00
sort sort: change let to let's 2019-01-27 01:34:56 +00:00
strconv strconv: remove use of DeepEqual for testing errors 2019-02-27 18:23:19 +00:00
strings
sync sync/atomic: add 32-bit MIPS to the 64-bit alignment requirement 2019-02-09 23:07:07 +00:00
syscall syscall: optimize SlicePtrFromStrings 2019-03-02 20:13:13 +00:00
testdata
testing all: fix typos as reported by 'misspell' 2019-02-26 23:02:05 +00:00
text text/template: error on method calls on nil interfaces 2019-02-26 18:05:09 +00:00
time time: move the explanation of u/micro to the ParseDuration example 2019-02-28 00:24:56 +00:00
unicode
unsafe
Make.dist
all.bash
all.bat
all.rc
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash cmd/dist: build exec wrappers during bootstrap 2019-02-26 17:59:23 +00:00
make.bash cmd/dist, cmd/link: allow passing default dynamic linker/loader 2019-03-01 06:06:13 +00:00
make.bat
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc