aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2016-04-28 11:19:53 -0400
committerAustin Clements <austin@google.com>2016-04-29 03:53:12 +0000
commit2e8b74b69574e969b5565e69cb54d39064b2dba1 (patch)
treea332fdd527e6a29cf4a952c532e147259f271c9a /src/runtime
parent15744c92de5e6a2295bfbae2126b19c124bbb46a (diff)
downloadgo-2e8b74b69574e969b5565e69cb54d39064b2dba1.tar.xz
[dev.garbage] runtime: document sysAlloc
In particular, it always returns an aligned pointer. Change-Id: I763789a539a4bfd8b0efb36a39a80be1a479d3e2 Reviewed-on: https://go-review.googlesource.com/22558 Reviewed-by: Rick Hudson <rlh@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/malloc.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index ec4939f1dd..2d8905b88d 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -387,6 +387,10 @@ func sysReserveHigh(n uintptr, reserved *bool) unsafe.Pointer {
return sysReserve(nil, n, reserved)
}
+// sysAlloc allocates the next n bytes from the heap arena. The
+// returned pointer is always _PageSize aligned and between
+// h.arena_start and h.arena_end. sysAlloc returns nil on failure.
+// There is no corresponding free function.
func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
if n > h.arena_end-h.arena_used {
// We are in 32-bit mode, maybe we didn't use all possible address space yet.