【发布时间】:2020-03-23 17:19:04
【问题描述】:
我使用带有 akka 后端的 sttp lib 从服务器加载文件。 以下任一方法都会导致加载 1Gb 文件时占用大量内存:
import com.softwaremill.sttp._
val file: File = new File(...)
sttp.response(asStream[Source[ByteString, Any]])
.mapResponse { src =>
src.runWith(FileIO.toPath(file.toPath, options, 0))
}
sttp.response(asFile(file, false))
是否有机会在写入后立即以块的形式写入数据并从内存中逐出块?
【问题讨论】:
标签: java scala memory-management akka-stream sttp