Possible memory leak
The following example prints the heap size of the memory shares. Upon every refresh, the size of the taskreducts
, taskvalues
, taskOutput
, and tasklist
increase. The total increase is around 20kB per refresh. I would expect that there is no state that should be kept, so that the sizes stay the same.
module test
import StdEnv
import qualified Data.Map
import graph_copy
import iTasks
import iTasks.Internal.IWorld
import iTasks.Internal.Task
:: DebugInfo =
{ memory_shares :: !ShareSizes
}
:: ShareSizes =
{ total_size :: !Int
, elements :: ![(String,Int)]
}
derive class iTask DebugInfo, ShareSizes
Start w = doTasks showDebugInfo w
showDebugInfo = getInfo >>- viewInformation []
where
getInfo :: Task DebugInfo
getInfo = mkInstantTask \_ iworld
# (info,iworld) = getInfo iworld
-> (Ok info, iworld)
where
getInfo :: !*IWorld -> (!DebugInfo, !*IWorld)
getInfo iworld=:{memoryShares} =
( {memory_shares=shareSizes memoryShares}
, iworld
)
shareSizes :: !('Data.Map'.Map String a) -> ShareSizes
shareSizes shares =
{ total_size = sum (map snd elements)
, elements = elements
}
where
elements = [(name, fst (usize (copy_to_string val))) \\ (name,val) <- 'Data.Map'.toList shares]