mirror of
				https://github.com/golang/go.git
				synced 2025-10-31 16:50:58 +00:00 
			
		
		
		
	runtime: account for tiny allocs, for testing.AllocsPerRun
Fixes #8734. LGTM=r, bradfitz, dvyukov R=bradfitz, r, dvyukov CC=golang-codereviews, iant, khr https://golang.org/cl/143150043
This commit is contained in:
		
							parent
							
								
									a883f117a9
								
							
						
					
					
						commit
						e19d8a47d1
					
				
					 7 changed files with 43 additions and 3 deletions
				
			
		|  | @ -103,7 +103,6 @@ func mallocgc(size uintptr, typ *_type, flags int) unsafe.Pointer { | |||
| 			// standalone escaping variables. On a json benchmark | ||||
| 			// the allocator reduces number of allocations by ~12% and | ||||
| 			// reduces heap size by ~20%. | ||||
| 
 | ||||
| 			tinysize := uintptr(c.tinysize) | ||||
| 			if size <= tinysize { | ||||
| 				tiny := unsafe.Pointer(c.tiny) | ||||
|  | @ -121,6 +120,7 @@ func mallocgc(size uintptr, typ *_type, flags int) unsafe.Pointer { | |||
| 					x = tiny | ||||
| 					c.tiny = (*byte)(add(x, size)) | ||||
| 					c.tinysize -= uintptr(size1) | ||||
| 					c.local_tinyallocs++ | ||||
| 					if debugMalloc { | ||||
| 						mp := acquirem() | ||||
| 						if mp.mallocing == 0 { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Russ Cox
						Russ Cox