Context: My language uses hint to interpret Haskell code at runtime, via `load: 
"path/to/file.hs"`. Hint works similar to ":load foo.hs" in GHCi (it uses the 
GHC API). After the source is interpreted the module's `load` function is 
executed in the language's VM. There is no valuable result; it is executed for 
its side-effects, usually definitions.

Problem: Around 80MB[1] is used up by the module's dependencies and never 
freed. Subsequent "load:"s are faster, but that 80MB overhead can be expensive 
on things like VPSes.

This can be simulated in GHCi by doing ":load foo.hs" followed by a ":load" to 
clear the loaded modules; the memory usage doesn't go down (understandably, in 
this case), and :loading it again is much faster.

Is there any way to "hard reset" or free the memory being used for the loaded 
module's dependencies?

Thanks,
Alex

[1]: number determined by loading an "empty" script, i.e. `load = return 
()`_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to