Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Delta Between Two Patch Sets: src/pkg/runtime/mgc0.c

Issue 69870055: code review 69870055: runtime: fix runaway memory usage (Closed)
Left Patch Set: Created 11 years ago
Right Patch Set: diff -r 7a45730704af https://dvyukov%40google.com@code.google.com/p/go/ Created 11 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/mcache.c ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(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 // Garbage collector (GC). 5 // Garbage collector (GC).
6 // 6 //
7 // GC is: 7 // GC is:
8 // - mark&sweep 8 // - mark&sweep
9 // - mostly precise (with the exception of some C-allocated objects, assembly fr ames/arguments, etc) 9 // - mostly precise (with the exception of some C-allocated objects, assembly fr ames/arguments, etc)
10 // - parallel (up to MaxGcproc threads) 10 // - parallel (up to MaxGcproc threads)
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 2339
2340 t4 = runtime·nanotime(); 2340 t4 = runtime·nanotime();
2341 mstats.last_gc = t4; 2341 mstats.last_gc = t4;
2342 mstats.pause_ns[mstats.numgc%nelem(mstats.pause_ns)] = t4 - t0; 2342 mstats.pause_ns[mstats.numgc%nelem(mstats.pause_ns)] = t4 - t0;
2343 mstats.pause_total_ns += t4 - t0; 2343 mstats.pause_total_ns += t4 - t0;
2344 mstats.numgc++; 2344 mstats.numgc++;
2345 if(mstats.debuggc) 2345 if(mstats.debuggc)
2346 runtime·printf("pause %D\n", t4-t0); 2346 runtime·printf("pause %D\n", t4-t0);
2347 2347
2348 if(runtime·debug.gctrace) { 2348 if(runtime·debug.gctrace) {
2349 heap1 = mstats.heap_alloc;
2349 updatememstats(&stats); 2350 updatememstats(&stats);
2350 » » heap1 = mstats.heap_alloc; 2351 » » if(heap1 != mstats.heap_alloc) {
2352 » » » runtime·printf("runtime: mstats skew: heap=%p/%p\n", hea p1, mstats.heap_alloc);
2353 » » » runtime·throw("mstats skew");
2354 » » }
2351 obj = mstats.nmalloc - mstats.nfree; 2355 obj = mstats.nmalloc - mstats.nfree;
2352 2356
2353 stats.nprocyield += work.markfor->nprocyield; 2357 stats.nprocyield += work.markfor->nprocyield;
2354 stats.nosyield += work.markfor->nosyield; 2358 stats.nosyield += work.markfor->nosyield;
2355 stats.nsleep += work.markfor->nsleep; 2359 stats.nsleep += work.markfor->nsleep;
2356 2360
2357 runtime·printf("gc%d(%d): %D+%D+%D ms, %D -> %D MB, %D (%D-%D) o bjects," 2361 runtime·printf("gc%d(%d): %D+%D+%D ms, %D -> %D MB, %D (%D-%D) o bjects,"
2358 " %d/%d/%d sweeps," 2362 " %d/%d/%d sweeps,"
2359 " %D(%D) handoff, %D(%D) steal, %D/%D/%D yields\ n", 2363 " %D(%D) handoff, %D(%D) steal, %D/%D/%D yields\ n",
2360 mstats.numgc, work.nproc, (t3-t2)/1000000, (t2-t1)/10000 00, (t1-t0+t4-t3)/1000000, 2364 mstats.numgc, work.nproc, (t3-t2)/1000000, (t2-t1)/10000 00, (t1-t0+t4-t3)/1000000,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2733 2737
2734 n = (h->arena_used - h->arena_start) / wordsPerBitmapWord; 2738 n = (h->arena_used - h->arena_start) / wordsPerBitmapWord;
2735 n = ROUND(n, bitmapChunk); 2739 n = ROUND(n, bitmapChunk);
2736 n = ROUND(n, PhysPageSize); 2740 n = ROUND(n, PhysPageSize);
2737 if(h->bitmap_mapped >= n) 2741 if(h->bitmap_mapped >= n)
2738 return; 2742 return;
2739 2743
2740 runtime·SysMap(h->arena_start - n, n - h->bitmap_mapped, &mstats.gc_sys) ; 2744 runtime·SysMap(h->arena_start - n, n - h->bitmap_mapped, &mstats.gc_sys) ;
2741 h->bitmap_mapped = n; 2745 h->bitmap_mapped = n;
2742 } 2746 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b