I wrote a small program, kind of specialized HTTP server in haskell, which is not much more complex than the code below. What puzzles me is its memory consumption. Say, when I run a test compiled from the enclosed code and make several POST requests containing up to 20Mb body whole program will have VM size of ~800Mb and this sounds odd. And this space is not returned to system if I leave an instance of such program running idle.
What does this 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