caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Finalising bigarrays
@ 2004-03-25  1:01 Shivkumar Chandrasekaran
  2004-03-25  9:35 ` Damien Doligez
  0 siblings, 1 reply; 2+ messages in thread
From: Shivkumar Chandrasekaran @ 2004-03-25  1:01 UTC (permalink / raw)
  To: caml-list

Hi,

If anybody knows the answer to the following question I will appreciate 
learning of it:

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

Thanks,

--shiv--

-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Finalising bigarrays
  2004-03-25  1:01 [Caml-list] Finalising bigarrays Shivkumar Chandrasekaran
@ 2004-03-25  9:35 ` Damien Doligez
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Doligez @ 2004-03-25  9:35 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-25  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-25  1:01 [Caml-list] Finalising bigarrays Shivkumar Chandrasekaran
2004-03-25  9:35 ` Damien Doligez

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).