You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							20 lines
						
					
					
						
							291 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							20 lines
						
					
					
						
							291 B
						
					
					
				| package buffer_pool | |
| 
 | |
| import ( | |
| 	"bytes" | |
| 	"sync" | |
| ) | |
| 
 | |
| var syncPool = sync.Pool{ | |
| 	New: func() interface{} { | |
| 		return new(bytes.Buffer) | |
| 	}, | |
| } | |
| 
 | |
| func SyncPoolGetBuffer() *bytes.Buffer { | |
| 	return syncPool.Get().(*bytes.Buffer) | |
| } | |
| 
 | |
| func SyncPoolPutBuffer(buffer *bytes.Buffer) { | |
| 	syncPool.Put(buffer) | |
| }
 |