LEFT | RIGHT |
(no file at all) | |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // On 32-bit, we don't bother limiting anything: 20 bits for 4G. | 117 // On 32-bit, we don't bother limiting anything: 20 bits for 4G. |
118 #ifdef _64BIT | 118 #ifdef _64BIT |
119 MHeapMap_Bits = 22, | 119 MHeapMap_Bits = 22, |
120 #else | 120 #else |
121 MHeapMap_Bits = 20, | 121 MHeapMap_Bits = 20, |
122 #endif | 122 #endif |
123 | 123 |
124 // Max number of threads to run garbage collection. | 124 // Max number of threads to run garbage collection. |
125 // 2, 3, and 4 are all plausible maximums depending | 125 // 2, 3, and 4 are all plausible maximums depending |
126 // on the hardware details of the machine. The garbage | 126 // on the hardware details of the machine. The garbage |
127 » // collector scales well to 4 cpus. | 127 » // collector scales well to 8 cpus. |
128 » MaxGcproc = 4, | 128 » MaxGcproc = 8, |
129 }; | 129 }; |
130 | 130 |
131 // A generic linked list of blocks. (Typically the block is bigger than sizeof(
MLink).) | 131 // A generic linked list of blocks. (Typically the block is bigger than sizeof(
MLink).) |
132 struct MLink | 132 struct MLink |
133 { | 133 { |
134 MLink *next; | 134 MLink *next; |
135 }; | 135 }; |
136 | 136 |
137 // SysAlloc obtains a large chunk of zeroed memory from the | 137 // SysAlloc obtains a large chunk of zeroed memory from the |
138 // operating system, typically on the order of a hundred kilobytes | 138 // operating system, typically on the order of a hundred kilobytes |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 void runtime·MProf_Malloc(void*, uintptr); | 414 void runtime·MProf_Malloc(void*, uintptr); |
415 void runtime·MProf_Free(void*, uintptr); | 415 void runtime·MProf_Free(void*, uintptr); |
416 void runtime·MProf_GC(void); | 416 void runtime·MProf_GC(void); |
417 int32 runtime·gcprocs(void); | 417 int32 runtime·gcprocs(void); |
418 void runtime·helpgc(int32 nproc); | 418 void runtime·helpgc(int32 nproc); |
419 void runtime·gchelper(void); | 419 void runtime·gchelper(void); |
420 | 420 |
421 bool runtime·getfinalizer(void *p, bool del, void (**fn)(void*), int32 *nret)
; | 421 bool runtime·getfinalizer(void *p, bool del, void (**fn)(void*), int32 *nret)
; |
422 void runtime·walkfintab(void (*fn)(void*)); | 422 void runtime·walkfintab(void (*fn)(void*)); |
LEFT | RIGHT |