aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.h
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2013-06-10 09:20:27 +0400
committerDmitriy Vyukov <dvyukov@google.com>2013-06-10 09:20:27 +0400
commit4f514e8691afe7557a01073d766d1a7240269634 (patch)
tree21585bdc600d775b8f8bbee82ac8dbe682bbb36b /src/pkg/runtime/malloc.h
parent83445fdcc3639fc102c11aa1820d592a8615cc86 (diff)
downloadgo-4f514e8691afe7557a01073d766d1a7240269634.tar.xz
runtime: use persistentalloc instead of SysAlloc in FixAlloc
Also reduce FixAlloc allocation granulatiry from 128k to 16k, small programs do not need that much memory for MCache's and MSpan's. R=golang-dev, khr CC=golang-dev https://golang.org/cl/10140044
Diffstat (limited to 'src/pkg/runtime/malloc.h')
-rw-r--r--src/pkg/runtime/malloc.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h
index 41604501f0..94907b1b0e 100644
--- a/src/pkg/runtime/malloc.h
+++ b/src/pkg/runtime/malloc.h
@@ -108,7 +108,7 @@ enum
// Tunable constants.
MaxSmallSize = 32<<10,
- FixAllocChunk = 128<<10, // Chunk size for FixAlloc
+ FixAllocChunk = 16<<10, // Chunk size for FixAlloc
MaxMHeapList = 1<<(20 - PageShift), // Maximum page length for fixed-size list in MHeap.
HeapAllocChunk = 1<<20, // Chunk size for heap growth
@@ -188,7 +188,6 @@ void* runtime·SysReserve(void *v, uintptr nbytes);
struct FixAlloc
{
uintptr size;
- void *(*alloc)(uintptr);
void (*first)(void *arg, byte *p); // called first time p is returned
void *arg;
MLink *list;
@@ -198,7 +197,7 @@ struct FixAlloc
uintptr sys; // bytes obtained from system
};
-void runtime·FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr), void (*first)(void*, byte*), void *arg);
+void runtime·FixAlloc_Init(FixAlloc *f, uintptr size, void (*first)(void*, byte*), void *arg);
void* runtime·FixAlloc_Alloc(FixAlloc *f);
void runtime·FixAlloc_Free(FixAlloc *f, void *p);
@@ -432,7 +431,7 @@ struct MHeap
};
extern MHeap runtime·mheap;
-void runtime·MHeap_Init(MHeap *h, void *(*allocator)(uintptr));
+void runtime·MHeap_Init(MHeap *h);
MSpan* runtime·MHeap_Alloc(MHeap *h, uintptr npage, int32 sizeclass, int32 acct, int32 zeroed);
void runtime·MHeap_Free(MHeap *h, MSpan *s, int32 acct);
MSpan* runtime·MHeap_Lookup(MHeap *h, void *v);