haskell
haskell copied to clipboard
Space leak in getNodes or getFetch
In a production server we had a major space leak that I tracked down to our usage of tensorflow. Heavily simplified our code looked like:
runSession $ do
addGraphDef g
forever $ do
...
output <- runWithFeeds [ feed inTens ... ] outTens
...
After changing the code to the following the space leak went away:
runSession $ do
addGraphDef g
ns <- build $ getNodes outTens
fetch <- build $ getFetch outTens
forever $ do
...
output <- runFetchWithFeeds [ feed inTens ... ] ns fetch
...
Note that for this to build I did have to patch tensorflow to export runFetchWithFeeds.
So clearly build $ getNodes t and / or build $ getFetch t is leaking. Any idea why?
@basvandijk if you happen to have a smallish test case I'll happily start with it rather than writing my own. If not - no sweat.