I tried putting together a resource pool and HDBC the other day but noticed that the memory keeps rising for each query. I then put together a simple test code using as few functions as possible and got this:
data SQL = SQL (Pool Connection)
check :: SQL -> IO ()
check (SQL pool) = do res <- query' pool "show status like 'Threads_conn%'" []
threadDelay 100000
check (SQL pool)
Whole code: http://upaste.me/40f2229cef7157f
For each recursion of the check function, the program uses more and more memory. Shouldn't the result be garbage collected at a new recursive call or will it stay in memory until the program exits that function in case "we need it"?