github.com/metacubex/mihomo@v1.18.5/common/pool/buffer_low_memory.go (about)

     1  //go:build with_low_memory
     2  
     3  package pool
     4  
     5  const (
     6  	// io.Copy default buffer size is 32 KiB
     7  	// but the maximum packet size of vmess/shadowsocks is about 16 KiB
     8  	// so define a buffer of 20 KiB to reduce the memory of each TCP relay
     9  	RelayBufferSize = 16 * 1024
    10  
    11  	// RelayBufferSize uses 20KiB, but due to the allocator it will actually
    12  	// request 32Kib. Most UDPs are smaller than the MTU, and the TUN's MTU
    13  	// set to 9000, so the UDP Buffer size set to 16Kib
    14  	UDPBufferSize = 8 * 1024
    15  )