LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Memory allocator, based on tcmalloc. | 5 // Memory allocator, based on tcmalloc. |
6 // http://goog-perftools.sourceforge.net/doc/tcmalloc.html | 6 // http://goog-perftools.sourceforge.net/doc/tcmalloc.html |
7 | 7 |
8 // The main allocator works in runs of pages. | 8 // The main allocator works in runs of pages. |
9 // Small allocation sizes (up to and including 32 kB) are | 9 // Small allocation sizes (up to and including 32 kB) are |
10 // rounded to one of about 100 size classes, each of which | 10 // rounded to one of about 100 size classes, each of which |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 { | 183 { |
184 uintptr size; | 184 uintptr size; |
185 void *(*alloc)(uintptr); | 185 void *(*alloc)(uintptr); |
186 void (*first)(void *arg, byte *p); // called first time p is return
ed | 186 void (*first)(void *arg, byte *p); // called first time p is return
ed |
187 void *arg; | 187 void *arg; |
188 MLink *list; | 188 MLink *list; |
189 byte *chunk; | 189 byte *chunk; |
190 uint32 nchunk; | 190 uint32 nchunk; |
191 uintptr inuse; // in-use bytes now | 191 uintptr inuse; // in-use bytes now |
192 uintptr sys; // bytes obtained from system | 192 uintptr sys; // bytes obtained from system |
193 » uintptr cached; | 193 » uintptr cached;»// number of cached objects |
194 }; | 194 }; |
195 | 195 |
196 void runtime·FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr)
, void (*first)(void*, byte*), void *arg); | 196 void runtime·FixAlloc_Init(FixAlloc *f, uintptr size, void *(*alloc)(uintptr)
, void (*first)(void*, byte*), void *arg); |
197 void* runtime·FixAlloc_Alloc(FixAlloc *f); | 197 void* runtime·FixAlloc_Alloc(FixAlloc *f); |
198 void runtime·FixAlloc_Free(FixAlloc *f, void *p); | 198 void runtime·FixAlloc_Free(FixAlloc *f, void *p); |
199 | 199 |
200 | 200 |
201 // Statistics. | 201 // Statistics. |
202 // Shared with Go: if you edit this structure, also edit type MemStats in mem.go
. | 202 // Shared with Go: if you edit this structure, also edit type MemStats in mem.go
. |
203 struct MStats | 203 struct MStats |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 TypeInfo_Map = 2, | 485 TypeInfo_Map = 2, |
486 | 486 |
487 // Enables type information at the end of blocks allocated from heap···· | 487 // Enables type information at the end of blocks allocated from heap···· |
488 DebugTypeAtBlockEnd = 0, | 488 DebugTypeAtBlockEnd = 0, |
489 }; | 489 }; |
490 | 490 |
491 // defined in mgc0.go | 491 // defined in mgc0.go |
492 void runtime·gc_m_ptr(Eface*); | 492 void runtime·gc_m_ptr(Eface*); |
493 | 493 |
494 void runtime·memorydump(void); | 494 void runtime·memorydump(void); |
LEFT | RIGHT |