caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: Enrico Tassi <enrico.tassi@inria.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] unmarshaling large data from string on 32 bits
Date: Thu, 05 Feb 2015 09:56:00 +0100	[thread overview]
Message-ID: <54D33020.6010707@lexifi.com> (raw)
In-Reply-To: <20150202103256.GA30053@birba.invalid>

Hello,

Be aware when using the generic demarshaling on 32 bit systems with 
large data (even when they fit in a string):  this will expand the heap 
(adding more pages to it) on every demarshaling, and unless you arrange 
so that the compacter runs often enough (calling manually Gc.compact for 
instance), you'll end up eating all the memory.

This is documented here:

http://caml.inria.fr/mantis/view.php?id=5813

One possible work-around is to use an alternative implementation of the 
demarshaler (there is such a pure OCaml implementation in Frama-C). 
Another is to avoid the generic marshaling, either by writing a manual 
version for your specific data type or by generating it from your type 
definitions (à la bin-prot, I assume).


Alain



On 02/02/2015 11:32 AM, Enrico Tassi wrote:
> Hello, I've just discovered that on 32 bits systems strings are
> limited to 16M.  I'm using strings as buffers holding data to
> be unmarshaled.  I could use another data structure, like a Buffer.t,
> but I see no API for unmarshaling from a Buffer.t.
>
> Is there another way? Is there code out there implementing that?
>
> Best,
>


  parent reply	other threads:[~2015-02-05  8:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 10:32 Enrico Tassi
2015-02-02 12:00 ` Gabriel Scherer
2015-02-02 13:08   ` Pierre-Marie Pédrot
2015-02-04 16:47   ` Enrico Tassi
2015-02-04 23:51     ` Gerd Stolpmann
2015-02-05  8:56 ` Alain Frisch [this message]
2015-02-05  9:01   ` Gabriel Scherer
2015-02-05  9:34     ` Alain Frisch
2015-02-05  9:58   ` Pierre-Marie Pédrot
2015-02-05 10:33     ` Enrico Tassi
2015-02-05 10:50     ` Alain Frisch
2015-02-05 12:22       ` Fabrice Le Fessant
2015-02-05 12:24         ` Alain Frisch
2015-02-05 12:27       ` Enrico Tassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D33020.6010707@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=enrico.tassi@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).