1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00
This commit is contained in:
Darien Raymond 2017-02-17 17:24:39 +01:00
commit 587ada599c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -2,6 +2,7 @@ package buf
import (
"os"
"runtime"
"strconv"
"sync"
)
@ -107,8 +108,17 @@ var (
smallPool = NewSyncPool(SizeSmall)
)
func getDefaultPoolSize() uint32 {
switch runtime.GOARCH {
case "amd64", "386":
return 20
default:
return 5
}
}
func init() {
var size uint32 = 20
var size uint32 = getDefaultPoolSize()
sizeStr := os.Getenv(poolSizeEnvKey)
if len(sizeStr) > 0 {
customSize, err := strconv.ParseUint(sizeStr, 10, 32)