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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 }; | 95 }; |
96 typedef uintptr PageID; // address >> PageShift | 96 typedef uintptr PageID; // address >> PageShift |
97 | 97 |
98 enum | 98 enum |
99 { | 99 { |
100 // Computed constant. The definition of MaxSmallSize and the | 100 // Computed constant. The definition of MaxSmallSize and the |
101 // algorithm in msize.c produce some number of different allocation | 101 // algorithm in msize.c produce some number of different allocation |
102 // size classes. NumSizeClasses is that number. It's needed here | 102 // size classes. NumSizeClasses is that number. It's needed here |
103 // because there are static arrays of this length; when msize runs its | 103 // because there are static arrays of this length; when msize runs its |
104 // size choosing algorithm it double-checks that NumSizeClasses agrees. | 104 // size choosing algorithm it double-checks that NumSizeClasses agrees. |
105 » NumSizeClasses = 67, | 105 » NumSizeClasses = 68, |
106 | 106 |
107 // Tunable constants. | 107 // Tunable constants. |
108 MaxSmallSize = 32<<10, | 108 MaxSmallSize = 32<<10, |
109 | 109 |
110 // Tiny allocator parameters, see "Tiny allocator" comment in malloc.goc
. | 110 // Tiny allocator parameters, see "Tiny allocator" comment in malloc.goc
. |
111 TinySize = 16, | 111 TinySize = 16, |
112 TinySizeClass = 2, | 112 TinySizeClass = 2, |
113 | 113 |
114 FixAllocChunk = 16<<10, // Chunk size for FixAlloc | 114 FixAllocChunk = 16<<10, // Chunk size for FixAlloc |
115 MaxMHeapList = 1<<(20 - PageShift), // Maximum page length for fixed
-size list in MHeap. | 115 MaxMHeapList = 1<<(20 - PageShift), // Maximum page length for fixed
-size list in MHeap. |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 // defined in mgc0.go | 579 // defined in mgc0.go |
580 void runtime·gc_m_ptr(Eface*); | 580 void runtime·gc_m_ptr(Eface*); |
581 void runtime·gc_g_ptr(Eface*); | 581 void runtime·gc_g_ptr(Eface*); |
582 void runtime·gc_itab_ptr(Eface*); | 582 void runtime·gc_itab_ptr(Eface*); |
583 | 583 |
584 int32 runtime·setgcpercent(int32); | 584 int32 runtime·setgcpercent(int32); |
585 | 585 |
586 // Value we use to mark dead pointers when GODEBUG=gcdead=1. | 586 // Value we use to mark dead pointers when GODEBUG=gcdead=1. |
587 #define PoisonGC ((uintptr)0xf969696969696969ULL) | 587 #define PoisonGC ((uintptr)0xf969696969696969ULL) |
588 #define PoisonStack ((uintptr)0x6868686868686868ULL) | 588 #define PoisonStack ((uintptr)0x6868686868686868ULL) |
LEFT | RIGHT |