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 // Page heap. | 5 // Page heap. |
6 // | 6 // |
7 // See malloc.h for overview. | 7 // See malloc.h for overview. |
8 // | 8 // |
9 // When a MSpan is in the heap free list, state == MSpanFree | 9 // When a MSpan is in the heap free list, state == MSpanFree |
10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span. | 10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 MHeap *h; | 359 MHeap *h; |
360 MSpan *s, *list; | 360 MSpan *s, *list; |
361 uint64 tick, now, forcegc, limit; | 361 uint64 tick, now, forcegc, limit; |
362 uint32 k, i; | 362 uint32 k, i; |
363 uintptr released, sumreleased; | 363 uintptr released, sumreleased; |
364 byte *env; | 364 byte *env; |
365 bool trace; | 365 bool trace; |
366 Note note, *notep; | 366 Note note, *notep; |
367 | 367 |
368 // If we go two minutes without a garbage collection, force one to run. | 368 // If we go two minutes without a garbage collection, force one to run. |
369 » forcegc = 10*1000; //2*60*1e9; | 369 » forcegc = 2*60*1e9; |
370 // If a span goes unused for 5 minutes after a garbage collection, | 370 // If a span goes unused for 5 minutes after a garbage collection, |
371 // we hand it back to the operating system. | 371 // we hand it back to the operating system. |
372 limit = 5*60*1e9; | 372 limit = 5*60*1e9; |
373 // Make wake-up period small enough for the sampling to be correct. | 373 // Make wake-up period small enough for the sampling to be correct. |
374 if(forcegc < limit) | 374 if(forcegc < limit) |
375 tick = forcegc/2; | 375 tick = forcegc/2; |
376 else | 376 else |
377 tick = limit/2; | 377 tick = limit/2; |
378 | 378 |
379 trace = false; | 379 trace = false; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 runtime·printf("failed MSpanList_Insert %p %p %p\n", span, span-
>next, span->prev); | 487 runtime·printf("failed MSpanList_Insert %p %p %p\n", span, span-
>next, span->prev); |
488 runtime·throw("MSpanList_Insert"); | 488 runtime·throw("MSpanList_Insert"); |
489 } | 489 } |
490 span->next = list->next; | 490 span->next = list->next; |
491 span->prev = list; | 491 span->prev = list; |
492 span->next->prev = span; | 492 span->next->prev = span; |
493 span->prev->next = span; | 493 span->prev->next = span; |
494 } | 494 } |
495 | 495 |
496 | 496 |
LEFT | RIGHT |