diff options
| author | hallgren <hallgren@chalmers.se> | 2014-04-10 15:55:33 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-04-10 15:55:33 +0000 |
| commit | 4008a2b1114983e0d98df157cf4b3bad2764ad52 (patch) | |
| tree | 6783be060bbece08e653b65875bb69ab8b7b86e9 /src/server/Cache.hs | |
| parent | 5f75baf56ad1eea70ae786a71f557f093688b741 (diff) | |
PGF web service: disable caching of parse results
Caching parse results uses a lot of memory, even if they expire after
2 minutes, so it won't scale up to many simultaneous users.
But some excessive memory use seems to be caused by space leaks in
(the Haskell binding to) the C run-time system, and these should be fixed.
For example, flushing the PGF cache does not release the memory allocated
by the C run-time system when loading a PGF file.
Diffstat (limited to 'src/server/Cache.hs')
| -rw-r--r-- | src/server/Cache.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/Cache.hs b/src/server/Cache.hs index d7c806783..bde07745a 100644 --- a/src/server/Cache.hs +++ b/src/server/Cache.hs @@ -4,6 +4,7 @@ import Control.Concurrent.MVar import Data.Map (Map) import qualified Data.Map as Map import System.Directory (getModificationTime) +import System.Mem(performGC) import Data.Time (UTCTime) import Data.Time.Compat (toUTCTime) @@ -18,7 +19,8 @@ newCache load = return $ Cache { cacheLoad = load, cacheObjects = objs } flushCache :: Cache a -> IO () -flushCache c = modifyMVar_ (cacheObjects c) (const (return Map.empty)) +flushCache c = do modifyMVar_ (cacheObjects c) (const (return Map.empty)) + performGC readCache :: Cache a -> FilePath -> IO a readCache c file = snd `fmap` readCache' c file |
