Hi Petr,

On Mon, Apr 06, 2009 at 02:14:56 +0000, [email protected] wrote:
> Sat Mar 21 04:22:37 GMT 2009  David Roundy <[email protected]>
>   * fix memory leak in check/repair

Could you have a look at this when you have a chance?

One thing to consider also is if this buys us any simplification to the
check/repair code.

Thanks!

fix memory leak in check/repair
-------------------------------
> David Roundy <[email protected]>**20090321042237
>  Ignore-this: 21a3f1766aafde76f4a6d471dc8ce13450930947
> ] hunk ./src/Darcs/Repository/HashedRepo.hs 211
>  write_and_read_patch :: RepoPatch p => Cache -> Compression -> PatchInfoAnd 
> p C(x y)
>                       -> IO (PatchInfoAnd p C(x y))
>  write_and_read_patch c compr p = do (i,h) <- write_patch_if_necesary c compr 
> p
> -                                    Sealed x <- createHashed h (parse i)
> -                                    return $ patchInfoAndPatch i $ 
> unsafeCoerceP x
> -    where parse i h = do debugMessage ("Reading patch file: "++ show 
> (human_friendly i))
> +                                    unsafeInterleaveIO $ readp h i
> +    where parse i h = do debugMessage ("Rereading patch file: "++ show 
> (human_friendly i))
>                           (fn,ps) <- fetchFileUsingCache c HashedPatchesDir h
>                           case readPatch ps of
>                             Just (x,_) -> return x
> hunk ./src/Darcs/Repository/HashedRepo.hs 219
>                             Nothing -> fail $ unlines ["Couldn't parse patch 
> file "++fn,
>                                                        "which is",
>                                                        renderString $ 
> human_friendly i]
> +          readp h i = do Sealed x <- createHashed h (parse i)
> +                         return $ patchInfoAndPatch i $ unsafeCoerceP x
>  
>  write_tentative_inventory :: RepoPatch p => Cache -> Compression -> PatchSet 
> p C(x) -> IO ()
>  write_tentative_inventory c compr = write_either_inventory c compr 
> "tentative_hashed_inventory"
> hunk ./src/Darcs/Repository/HashedRepo.hs 266
>  write_patch_if_necesary :: RepoPatch p => Cache -> Compression
>                          -> PatchInfoAnd p C(x y) -> IO (PatchInfo, String)
>  write_patch_if_necesary c compr hp =
> -    case extractHash hp of
> -    Right h -> return (info hp, h)
> -    Left p -> fmap (\h -> (info hp, h)) $ writeHashFile c compr 
> HashedPatchesDir $ showPatch p
> +    seq infohp $ case extractHash hp of
> +                   Right h -> return (infohp, h)
> +                   Left p -> (\h -> (infohp, h)) `fmap`
> +                             writeHashFile c compr HashedPatchesDir 
> (showPatch p)
> +    where infohp = info hp
>  
>  pihash :: (PatchInfo,String) -> Doc
>  pihash (pinf,hash) = showPatchInfo pinf $$ text ("hash: " ++ hash ++ "\n")
> 

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9

Attachment: pgpKm2d4dBpKX.pgp
Description: PGP signature

_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to