OLD | NEW |
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 enum | 400 enum |
401 { | 401 { |
402 // flags to malloc | 402 // flags to malloc |
403 FlagNoPointers = 1<<0, // no pointers here | 403 FlagNoPointers = 1<<0, // no pointers here |
404 FlagNoProfiling = 1<<1, // must not profile | 404 FlagNoProfiling = 1<<1, // must not profile |
405 FlagNoGC = 1<<2, // must not free or scan for pointers | 405 FlagNoGC = 1<<2, // must not free or scan for pointers |
406 }; | 406 }; |
407 | 407 |
408 void runtime·MProf_Malloc(void*, uintptr); | 408 void runtime·MProf_Malloc(void*, uintptr); |
409 void runtime·MProf_Free(void*, uintptr); | 409 void runtime·MProf_Free(void*, uintptr); |
410 int32» runtime·helpgc(void); | 410 int32» runtime·helpgc(bool*); |
411 void runtime·gchelper(void); | 411 void runtime·gchelper(void); |
412 | 412 |
413 // Malloc profiling settings. | 413 // Malloc profiling settings. |
414 // Must match definition in extern.go. | 414 // Must match definition in extern.go. |
415 enum { | 415 enum { |
416 MProf_None = 0, | 416 MProf_None = 0, |
417 MProf_Sample = 1, | 417 MProf_Sample = 1, |
418 MProf_All = 2, | 418 MProf_All = 2, |
419 }; | 419 }; |
420 extern int32 runtime·malloc_profile; | 420 extern int32 runtime·malloc_profile; |
421 | 421 |
422 typedef struct Finalizer Finalizer; | 422 typedef struct Finalizer Finalizer; |
423 struct Finalizer | 423 struct Finalizer |
424 { | 424 { |
425 Finalizer *next; // for use by caller of getfinalizer | 425 Finalizer *next; // for use by caller of getfinalizer |
426 void (*fn)(void*); | 426 void (*fn)(void*); |
427 void *arg; | 427 void *arg; |
428 int32 nret; | 428 int32 nret; |
429 }; | 429 }; |
430 | 430 |
431 Finalizer* runtime·getfinalizer(void*, bool); | 431 Finalizer* runtime·getfinalizer(void*, bool); |
OLD | NEW |