caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dbely@mail.ru>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Documentation request: allocation of bigarrays in C
Date: Mon, 03 Apr 2006 13:24:24 +0400	[thread overview]
Message-ID: <ek0fdnav.fsf@mail.ru> (raw)
In-Reply-To: <44303A0A.9020003@crans.org> (Li-Thiao-T's message of "Sun, 02 Apr 2006 22:54:34 +0200")

Li-Thiao-Té Sébastien <sayan@crans.org> writes:

> I do not know in advance the size of the multiple bigarrays to
> allocate. This is determined by parsing the file. To speed up the
> process, the file is parsed on the C side, which is why I want to do
> GC-friendly memory allocation directly from C.
> I do not believe that calling Bigarray.Genarray.create within a C
> parser is a nice way to do things, especially when there is the
> opportunity to use alloc_bigarray_xxx to allocate memory.

OK, probably the NULL case from alloc_bigarray() comment

/* [alloc_bigarray] will allocate a new bigarray object in the heap.
   If [data] is NULL, the memory for the contents is also allocated
   (with [malloc]) by [alloc_bigarray].
   [data] cannot point into the Caml heap.
   [dim] may point into an object in the Caml heap.
*/

should also be mentioned in the docs. If you believe it's necessary, file
the bug report at http://caml.inria.fr/mantis.

> NB: I do not return a single bigarray to ocaml, but a list of bigarrays.

It's hard to imagine when it's really needed, but probably you have ample
grounds for such design.

- Dmitry Bely


  reply	other threads:[~2006-04-03  9:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-31 14:02 sayan
2006-03-31 17:57 ` [Caml-list] " Dmitry Bely
2006-04-01 10:16   ` Li-Thiao-Té Sébastien
2006-04-01 10:30     ` Jonathan Roewen
2006-04-01 14:42       ` Li-Thiao-Té Sébastien
2006-04-02 13:56     ` Dmitry Bely
2006-04-02 20:54       ` Li-Thiao-Té Sébastien
2006-04-03  9:24         ` Dmitry Bely [this message]
2006-04-03 23:45         ` Nathaniel Gray

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=ek0fdnav.fsf@mail.ru \
    --to=dbely@mail.ru \
    --cc=caml-list@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).