I wrote a small program, like a specialized HTTP server in haskell, which is not much more complicated than the code below. I am puzzled by memory consumption. Let's say when I run a test made up of the attached code and make a few POST requests containing up to 20 MB of body, the whole program will have a size of VM ~ 800 MB, and that sounds strange. And this space does not return to the system if I leave an instance of such a program without downtime.
What does it mean?
import System.IO
import Network.HTTP.Server
import Network.Socket
import Network.URL
handler :: SockAddr -> URL -> Request String -> IO (Response String)
handler sa url rq = do
writeFile "/tmp/out" (rqBody rq)
return $ insertHeader HdrContentLength "0" (respond OK :: Response String)
main = serverWith defaultConfig {srvPort = 2121} handler
sacha source
share