withMemory

inline fun <R> withMemory(size: Int, block: (Memory) -> R): R
inline fun <R> withMemory(size: Long, block: (Memory) -> R): R

Deprecated

We're migrating to the new kotlinx-io library. This declaration is deprecated and will be removed in Ktor 4.0.0 If you have any problems with migration, please contact us in https://youtrack.jetbrains.com/issue/KTOR-6030/Migrate-to-new-kotlinx.io-library

Invoke block function with a temporary Memory instance of the specified size in bytes. The provided instance shouldn't be captured and used outside of the block otherwise an undefined behaviour may occur including crash and/or data corruption.