From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 8F3DBBC57 for ; Thu, 16 Dec 2010 13:58:03 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgBAGubCU3U4366kGdsb2JhbACDZJFyjl8VAQEBAQkJDAcRAyGwY5EQAoEfgzV0BIchhnM X-IronPort-AV: E=Sophos;i="4.59,354,1288566000"; d="scan'208";a="70779839" Received: from moutng.kundenserver.de ([212.227.126.186]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Dec 2010 13:58:03 +0100 Received: from office1.lan.sumadev.de (dslb-094-219-214-161.pools.arcor-ip.net [94.219.214.161]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MJYS7-1PQjdC3aEl-0033MB; Thu, 16 Dec 2010 13:58:01 +0100 Received: from [192.168.5.106] (dslb-094-219-214-161.pools.arcor-ip.net [94.219.214.161]) by office1.lan.sumadev.de (Postfix) with ESMTPA id 866B95F702; Thu, 16 Dec 2010 13:58:01 +0100 (CET) Subject: Re: [Caml-list] appending data to a mmap-ed file From: Gerd Stolpmann To: Joel Reymont Cc: caml-list@yquem.inria.fr In-Reply-To: <8D1E9D5B-188C-4AF3-980B-EF229BA98FB4@gmail.com> References: <8D1E9D5B-188C-4AF3-980B-EF229BA98FB4@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 16 Dec 2010 13:57:58 +0100 Message-ID: <1292504278.22147.292.camel@thinkpad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:7alovBIgOvm5CGXsZQCLDeiczX9/Yl0KYBIaj4Crf1I popYIPT2Z5Dz1/X1qhf3xxznXYVb24SKfwGqIkZW5axBxl15mf hInzj+BHmmaGp1RvtcOXxSOyXihZREvWPWP3oxq4TZ5D8tIhS6 lxIZGtAMZPaT/cZu6ycSn9CL4c4bXLKGkaPVaaMqDMat2dQmq0 cW+WQmBtebhtNAp4PFopg== X-Spam: no; 0.00; appending:01 gerd:01 stolpmann:01 donnerstag:01 appending:01 chunks:01 gerd:01 ocaml:01 ocaml:01 beginner's:01 bug:01 stolpmann:01 darmstadt:01 6151:01 6151:01 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 ------------------------------------------------------------