Fixed a memory leak due to excessive strictness when committing journal files.

When hashing the files, the entire list of shas was read strictly.
That was entirely unnecessary, since there's a cleanup action run
after they're consumed.
This commit is contained in:
Joey Hess 2012-02-14 11:20:30 -04:00
parent 82ae30d820
commit a40ec5e03e
4 changed files with 9 additions and 2 deletions

View file

@ -190,7 +190,7 @@ commit message = whenM journalDirty $ lockJournal $ do
{- Commits the staged changes in the index to the branch.
-
- Ensures that the branch's index file is first updated to the state
- of the brannch at branchref, before running the commit action. This
- of the branch at branchref, before running the commit action. This
- is needed because the branch may have had changes pushed to it, that
- are not yet reflected in the index.
-

View file

@ -19,7 +19,7 @@ hashFiles paths repo = do
fileEncoding toh
_ <- forkProcess (feeder toh)
hClose toh
shas <- map Ref . lines <$> hGetContentsStrict fromh
shas <- map Ref . lines <$> hGetContents fromh
return (shas, ender fromh pid)
where
git_hash_object = gitCommandLine

2
debian/changelog vendored
View file

@ -24,6 +24,8 @@ git-annex (3.20120124) UNRELEASED; urgency=low
its head), and records the size in the key.
* Fixed to use the strict state monad, to avoid leaking all kinds of memory
due to lazy state update thunks when adding/fixing many files.
* Fixed a memory leak due to excessive strictness when committing journal
files.
* whereis: Prints the urls of files that the web special remote knows about.
-- Joey Hess <joeyh@debian.org> Tue, 24 Jan 2012 16:21:55 -0400

View file

@ -27,6 +27,11 @@ A history of the leaks:
Apparently fixed in versions afer 3.20120123, but this one is not
well understood.
* Committing journal files turned out to have another memory leak.
After adding a lot of files ran out of memory, this left the journal
behind and could affect other git-anne commands. Fixed in versions afer
3.20120123.
* (Note that `git ls-files --others`, which is used to find files to add,
also uses surpsisingly large amounts
of memory when you have a lot of files. It buffers