caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Finalising bigarrays
Date: Thu, 25 Mar 2004 10:35:06 +0100	[thread overview]
Message-ID: <B339CDC8-7E3F-11D8-93C6-00039310CAE8@inria.fr> (raw)
In-Reply-To: <F5226607-7DF7-11D8-92B6-003065BDAA76@ece.ucsb.edu>

On Mar 25, 2004, at 02:01, Shivkumar Chandrasekaran wrote:

> I tried calling Gc.finalise on a bigarray and it did not raise an 
> exception. Does that mean finalisation of bigarrays will work?

A bigarray is composed of two things: a heap-allocated descriptor
block that tells the number of dimensions, the layout, etc, and
contains a pointer to the data.  The data is in an out-of-heap
block.

When you call Gc.finalise, you are finalising the descriptor
block.  That would not matter if there was a one-to-one mapping
between descriptor blocks and data blocks, but sometimes the
data block is shared between bigarrays (when you call slice_left,
slice_right, sub_left, sub_right, or the reshape functions).

Your finalisation function is called when the bigarray itself
is not used any more by your program, but you should beware that
its data may be used by other bigarrays.  Hence your finalisation
function must not overwrite the data, unless you are really sure
that it is not shared.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      reply	other threads:[~2004-03-25  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-25  1:01 Shivkumar Chandrasekaran
2004-03-25  9:35 ` Damien Doligez [this message]

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=B339CDC8-7E3F-11D8-93C6-00039310CAE8@inria.fr \
    --to=damien.doligez@inria.fr \
    --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).