]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make mcache.local_cachealloc a uintptr
authorAustin Clements <austin@google.com>
Mon, 13 Apr 2015 21:06:22 +0000 (17:06 -0400)
committerAustin Clements <austin@google.com>
Tue, 21 Apr 2015 15:35:41 +0000 (15:35 +0000)
This field used to decrease with sweeps (and potentially go
negative). Now it is always zero or positive, so change it to a
uintptr so it meshes better with other memory stats.

Change-Id: I6a50a956ddc6077eeaf92011c51743cb69540a3c
Reviewed-on: https://go-review.googlesource.com/8899
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/malloc.go
src/runtime/mcache.go

index 84a2ad71a46187621fb6bc8efa51f02ca4fba4be..4a2d3e3cac7ef0b08388fd9e24fa5a84f2d9d628 100644 (file)
@@ -623,7 +623,7 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer {
                                }
                        }
                }
-               c.local_cachealloc += intptr(size)
+               c.local_cachealloc += size
        } else {
                var s *mspan
                shouldhelpgc = true
index 14748a43f125abb79253fd2f29e0a322eb7f26a6..f01215379aef018290872ac2552eb44d202bc8c6 100644 (file)
@@ -11,8 +11,8 @@ import "unsafe"
 type mcache struct {
        // The following members are accessed on every malloc,
        // so they are grouped here for better caching.
-       next_sample      int32  // trigger heap sample after allocating this many bytes
-       local_cachealloc intptr // bytes allocated from cache since last lock of heap
+       next_sample      int32   // trigger heap sample after allocating this many bytes
+       local_cachealloc uintptr // bytes allocated from cache since last lock of heap
        // Allocator cache for tiny objects w/o pointers.
        // See "Tiny allocator" comment in malloc.go.
        tiny             unsafe.Pointer