mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-23 02:26:49 -05:00
reduce default pool size for non x86 platform to 5MB.
This commit is contained in:
parent
949a74edfa
commit
4d34d081f1
@ -2,6 +2,7 @@ package buf
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -107,8 +108,17 @@ var (
|
|||||||
smallPool = NewSyncPool(SizeSmall)
|
smallPool = NewSyncPool(SizeSmall)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getDefaultPoolSize() uint32 {
|
||||||
|
switch runtime.GOARCH {
|
||||||
|
case "amd64", "386":
|
||||||
|
return 20
|
||||||
|
default:
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var size uint32 = 20
|
var size uint32 = getDefaultPoolSize()
|
||||||
sizeStr := os.Getenv(poolSizeEnvKey)
|
sizeStr := os.Getenv(poolSizeEnvKey)
|
||||||
if len(sizeStr) > 0 {
|
if len(sizeStr) > 0 {
|
||||||
customSize, err := strconv.ParseUint(sizeStr, 10, 32)
|
customSize, err := strconv.ParseUint(sizeStr, 10, 32)
|
||||||
|
Loading…
Reference in New Issue
Block a user