Version française
Home     About     Download     Resources     Contact us    
Browse thread
appending data to a mmap-ed file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] appending data to a mmap-ed file
Am Donnerstag, den 16.12.2010, 11:31 +0000 schrieb Joel Reymont:
> I'm constantly appending to a file of stock quotes (ints, longs, doubles, etc.). I have this file mapped into memory with mmap. 
> 
> What's the most efficient way to make newly appended data available as part of the memory mapping?

Generally, you can only unmap the old mapping, and remap it. Don't know
whether you have an OS preference - Linux has also mremap, and it would
at least be possible to create a binding for it. mremap is non-portable,
though.

If you have all rights to define the file format yourself, I'd suggest
you use some kind of container, so you can append to the file in larger
chunks, and only when you need a new chunk, the mapping needs to be
re-established.

Gerd

> 
> Obligatory OCaml content: I'm trying to prototype a trading system in OCaml.
>  
> 	Thanks, Joel
> 
> ---
> http://twitter.com/wagerlabs
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 


-- 
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------