diff --git a/ktor-http/ktor-http-cio/common/src/io/ktor/http/cio/internals/CharArrayPool.kt b/ktor-http/ktor-http-cio/common/src/io/ktor/http/cio/internals/CharArrayPool.kt index a7d68cd9c97..993a2af0a43 100644 --- a/ktor-http/ktor-http-cio/common/src/io/ktor/http/cio/internals/CharArrayPool.kt +++ b/ktor-http/ktor-http-cio/common/src/io/ktor/http/cio/internals/CharArrayPool.kt @@ -6,7 +6,7 @@ package io.ktor.http.cio.internals import io.ktor.utils.io.pool.* -internal expect val DISABLE_CHAR_ARRAY_POOLING: Boolean +internal expect fun isPoolingDisabled(): Boolean internal const val CHAR_ARRAY_POOL_SIZE = 4096 @@ -15,7 +15,7 @@ internal const val CHAR_ARRAY_POOL_SIZE = 4096 */ internal const val CHAR_BUFFER_ARRAY_LENGTH: Int = 4096 / 2 -internal val CharArrayPool: ObjectPool = if (DISABLE_CHAR_ARRAY_POOLING) { +internal val CharArrayPool: ObjectPool = if (isPoolingDisabled()) { object : NoPoolImpl() { override fun borrow(): CharArray { return CharArray(CHAR_BUFFER_ARRAY_LENGTH) diff --git a/ktor-http/ktor-http-cio/js/src/io/ktor/http/cio/internals/CharArrayPoolJs.kt b/ktor-http/ktor-http-cio/js/src/io/ktor/http/cio/internals/CharArrayPoolJs.kt index 9fef1048944..5dfbcea2d8c 100644 --- a/ktor-http/ktor-http-cio/js/src/io/ktor/http/cio/internals/CharArrayPoolJs.kt +++ b/ktor-http/ktor-http-cio/js/src/io/ktor/http/cio/internals/CharArrayPoolJs.kt @@ -4,4 +4,4 @@ package io.ktor.http.cio.internals -internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false +internal actual fun isPoolingDisabled(): Boolean = false diff --git a/ktor-http/ktor-http-cio/jvm/src/io/ktor/http/cio/internals/CharArrayPoolJvm.kt b/ktor-http/ktor-http-cio/jvm/src/io/ktor/http/cio/internals/CharArrayPoolJvm.kt index 17a8db0e182..c3f7589b0b6 100644 --- a/ktor-http/ktor-http-cio/jvm/src/io/ktor/http/cio/internals/CharArrayPoolJvm.kt +++ b/ktor-http/ktor-http-cio/jvm/src/io/ktor/http/cio/internals/CharArrayPoolJvm.kt @@ -4,5 +4,5 @@ package io.ktor.http.cio.internals -internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = +internal actual fun isPoolingDisabled(): Boolean = System.getProperty("ktor.internal.cio.disable.chararray.pooling")?.toBoolean() ?: false diff --git a/ktor-http/ktor-http-cio/posix/src/io/ktor/http/cio/internals/CharArrayPoolPosix.kt b/ktor-http/ktor-http-cio/posix/src/io/ktor/http/cio/internals/CharArrayPoolPosix.kt index 9fef1048944..5dfbcea2d8c 100644 --- a/ktor-http/ktor-http-cio/posix/src/io/ktor/http/cio/internals/CharArrayPoolPosix.kt +++ b/ktor-http/ktor-http-cio/posix/src/io/ktor/http/cio/internals/CharArrayPoolPosix.kt @@ -4,4 +4,4 @@ package io.ktor.http.cio.internals -internal actual val DISABLE_CHAR_ARRAY_POOLING: Boolean = false +internal actual fun isPoolingDisabled(): Boolean = false