[darcs-users] Using Darcs for large projects

David Roundy droundy at abridgegame.org
Sat Jun 19 10:28:19 UTC 2004


On Fri, Jun 18, 2004 at 04:45:55PM +0200, Peter Strand wrote:
> David Roundy wrote:
> >It does.  I believe there isn't any mmap support in the windows build,
> >which will make a huge difference if the files in your repo are
> >reasonably big (as oppposed to there just being many of them).  There
> >was an attempt at mmap support in windows, but I believe it was broken,
> >probably mostly because windows has different semantics from POSIX in
> >this regard--I seem to recall that if you delete a file which is mmapped
> >you mess things up (unlike on POSIX systems).  Can someone correct me if
> >I'm wrong about this?  (since I've not worked on windows myself)
> 
> The problem is that opened or mapped files cannot be removed, and since
> it is the finalizer for FastPackedString that unmaps, we don't know when
> it is possible to delete the file.
> 
> I don't really know how to solve it, unless we can live with manually
> "freeing" FastPackedStrings, or using a
> 
>  withMMapFilePS :: FilePath -> (PackedString -> IO a) -> IO a
> 
> or keep track of files which should be removed and do it later, when we
> know it is possible, or some other dirty hack..
> 
> 
> How often does darcs want to mmap files that might get removed?

Unfortunately, I suspect this happens very often, since every time we
modify a file, we do it by writing a new copy and removing the old
one--precisely to avoid breaking the mmap behavior (since if we modify an
existing file, that would be bad).

I think there may be merit to your idea of keeping track of files to be
removed and doing it later.  Could we perhaps simply move them to the
Recycle Bin? Or we could create a darcs-internal trash directory, and move
all files there rather than deleting them, and when darcs exits delete that
directory...  Probably we would actually just have to fix the one function
Lock.writeToFile, since I suspect we don't actually removeFile directly on
files that we've been reading very often.  Although I guess it would be
safer to also check out the removeFile occurances in SlurpDirectory.lhs.

It would definitely be *very* nice to have mmap work on windows.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list